ToolbarButton

Form and theme XML code and CSS element selector

Inheritance diagram

Most commonly used form and theme properties

Associated 4gl syntax, functions, and ui methods

Influence and behavior

ToolbarButton is a button on a toolbar which is used to invoke actions.

ToolbarButton can include labels, icons, or tooltips.

oolbar with 2 toolbar buttons inserted in a Grid panel as seen in Lycia Form Builder.

Form XML code:

<ToolbarButton text="tbButton 1" visible="true" identifier="tbButton1">

   <ToolbarButton.onInvoke>

      <ActionEventHandler type="actioneventhandler" actionName="actTbButton"/>

   </ToolbarButton.onInvoke>

</ToolbarButton>  

Theme element filter XML code:

<ElementFilter ElementName="ToolbarButton">

   ...

</ElementFilter>

CSS element selector code:

qx-aum-toolbar-button

Inheritance diagram:

Most commonly used form properties:

classnames

Events: OnInvoke

identifier

image

preferredSize

text

tooltip

Most commonly used theme properties:

Image:

New Image

Image Url

Image Scaling

Image Position

Size

Associated 4gl syntax:

INPUT 

Associated functions:

fgl_setactionlabel()

fgl_getactionlabel()

fgl_setkeylabel()

fgl_getkeylabel()

fgl_dialog_setactionlabel()

fgl_dialog_getactionlabel()

fgl_dialog_setkeylabel()

Associated ui methods:

SetAllowNewLines 

GetAllowNewLines

SetIdentifier 

GetIdentifier 

SetText 

GetText

Influence and behavior:

Note: The Toolbar and ToolbarButton display (visible or hidden in the dropdown list) is controlled by the place property. To learn more, refer to its page: The 'place' property.

To add a ToolbarButton to your form, drag-and-drop the ToolbarButton widget from the Palette to the Design Area, into the previously placed Toolbar.

 

To make toolbar buttons active and trigger an event only when focus is a definite field,

4gl code sample:

MENU

  COMMAND "input"

    INPUT BY NAME f1

      ON ACTION "show_yes" INFIELD f1

        DISPLAY "yes"

      ON ACTION "show_no" INFIELD f1

        DISPLAY "no"

    END INPUT

  COMMAND "exit"

    EXIT MENU

END MENU

runtime behavior:

 

At runtime, toolbar buttons can be manipulated with ui methods.

Here you can find out how to enable or disable tooltips at runtime using the setTooltip() method:

 

You can change appearance properties of a ToolbarButton in Lycia Form Builder. However, we recommend applying appearance properties via user themes and css.

To apply a property to a ToolbarButton, set its value in the user theme, directly or using filters.

In the example below, we specify the appearance of toolbar buttons by applying Fill Color property.

lycia theme designer

theme XML code

<?xml version="1.0" encoding="utf-8"?>

<StyleSheet xmlns="http://querix.com">

  <ElementFilter ElementName="ToolbarButton">

    <StyleSheet>

      <DoStyleAction>

        <SetProperty>

          <PropertyPath>

            <PropertyName>Background</PropertyName>

            <PropertyName>FillColor</PropertyName>

          </PropertyPath>

          <PropertyValue type="CustomizedColor" RedColor="120" GreenColor="144" BlueColor="156" Alpha="255" />

        </SetProperty>

      </DoStyleAction>

    </StyleSheet>

  </ElementFilter>

</StyleSheet>

runtime appearance

 

Appearance and behavior of toolbar buttons depend on the Lycia version you use – jquery Lycia or Lycia with Material Design.

Here are the rules which are applied to toolbar buttons with MD Lycia:

  1. The buttons that only have an icon are rendered as icon-only buttons (without text).

  2. The buttons that have no icon are rendered as text-only.
  3. The buttons that have an icon and a Text property filled are rendered as icon-only.
  4. The actions triggered by the COMMAND and ON ACTION statements are rendered to text-only buttons in Lycia compatibility mode. In other modes, the behaviour may vary.

  5. The position of the buttons (rendered to the navigation bar or rendered to the dropdown menu) is controlled by the place property.

All these rules apply to both toolbar buttons created via the ToolbarButton widget, dynamically (by the corresponding UI methods), and by the MENU statement).

The difference between these two types of toolbar buttons (in relation to MD Lycia) lies in how you set their text and icon:

 

By default, the placement of the toolbar buttons is controlled by the window size and the size of each of the buttons. If there's not enough place in the Toolbar at the current window size to fit all the buttons, some of them will be rendered to the dropdown menu (marked with a three-dot button in the right side of the Toolbar).

Additionally, there are several ways to force the placement of each of the buttons:

 

At runtime, you can create and manipulate toolbar buttons with ui methods.

You cannot create a Toolbar widget by ui methods – only the ToolbarButton widget.

If your .fm2 form has a Toolbar widget, you can populate it via ui methods:

DEFINE tb_group ui.ToolbarGroup

DEFINE tb_button ui.ToolbarButton

...

LET tb_group = ui.ToolbarGroup.Create("tbg","toolbar")

LET tb_button = ui.ToolbarButton.Create("bt1","tbg")

CALL tb_button.SetText("form button")

To make this newly created toolbar button able to trigger any actions, you must set the event for it:

DEFINE buttonEvent ui.BackgroundServerEventHandler

...

LET buttonEvent = ui.BackgroundServerEventHandler.Create()

CALL buttonEvent.SetCallBackAction("display")

CALL tb_button.SetOnInvoke(buttonEvent)

So the simple algorithm for adding toolbar buttons by ui methods is this:

  1. Check that your form has a Toolbar widget.
  2. Define variables of ui.ToolbarGroup, ui.ToolbarButton, and ui.BackgroundServerEventHandler data types in your 4gl code.
  3. Use the create() method to create a toolbar group.
  4. Use the create() method to create a toolbar button. Make sure that you have specified the correct toolbar group.
  5. Set the event for this toolbar button.

 

All properties of a toolbar button can be changed at runtime by ui methods.

For example,

 

 

Contact Us

Privacy Policy

Copyright © 2026 Querix, (UK) Ltd.