Button

Form and theme XML code and CSS element selector

Inheritance diagram

Most commonly used form and theme properties

Associated 4gl syntax and ui methods

Influence and behavior

Button is a control element which triggers an event. It can show a text label, image, or both.

Button inserted in a GridPanel as seen in Lycia Form Designer:

Form XML code:

<Button text="Button"identifier="bt1">

   <Button.onInvoke>

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

   </Button.onInvoke>

</Button>

Theme element filter XML code:

<ElementFilter ElementName="Button">

   ...

</ElementFilter>

CSS element selector code:

qx-aum-button

.qx-aum-button .qx-text

.qx-aum-button .qx-image

Inheritance diagram:

Most commonly used form properties:

classnames

Events: OnInvoke

identifier

horizontalAlignment

verticalAlignment

maxSize

minSize

preferredSize

text

tooltip

Most commonly used theme properties:

Image:

New Image

Image Url

Image Scaling

Image Position

Size

Location

Background:

New Background

Fill Color

Background Image

Background Style

Size

Location

Margin

Padding

Associated 4gl syntax:

DISPLAY ... TO

ON KEY 

ON ACTION 

Associated ui methods:

SetEnable

GetEnable

SetIdentifier

GetIdentifier

SetOnInvoke

GetOnInvoke

SetImage

GetImage

SetIsToggleButton

GetIsToggleButton

SetIsPressed

GetIsPressed

SetAllowNewlines 

GetAllowNewlines

Create

ForName

Influence and behavior:

To add a Button to your form, you

Step 1. Choose a Button from the widgets palette by left-clicking its icon.

Step 2. Select the place in the form where you want to put the Button.

Step 3. Left-click the selected spot (cell or sector) to place the Button there.

Step 4. The Button is now added to your form, and you can see it in the Structure view.

 

Here you can find out how to change the text of the button in the form:

Here you can find out how to change the text of the button at runtime using ui methods or DISPLAY ... TO statement.

 

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

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

property applied in the user theme

theme XML code

runtime behavior

In the example below, we use css to change the text style of the button as above:

.qx-aum-button .qx-text {

    padding: 2px;

    padding: 5px 10px;

    color: white !important;

    font: bold 14px "Calibri","Helvetica Neue", Sans-Serif;

}

 

Buttons are active by default if their associated event exists in the current runtime scope. Otherwise, they will be inactive . However, this behavior can be disabled using the enable property.

At runtime, buttons can also be enabled/disabled.

To activate/deactivate buttons at runtime:

 

To change the button appearance at runtime;

 

At runtime, Button can be manipulated with ui methods.

Below you can find out how to use ui methods to display an image to the button.

4gl code sample

MAIN

  DEFINE bt_ui1,

         bt_ui2     ui.Button,

         image_ui   ui.Image,

         isImageSet SMALLINT

    OPEN WINDOW w1 WITH FORM "button_ui_setimage" ATTRIBUTE(BORDER)

  LET bt_ui1 = ui.Button.forName("bt1")

  CALL image_ui.setImageUrl("qx://application/ok.png")

  CALL bt_ui1.setText("Button for image")

  CALL bt_ui1.SetEnable(TRUE)

    MENU

    ON ACTION "Image"

      IF isImageSet THEN

        LET isImageSet = 0

        CALL bt_ui1.SetImage("")

      ELSE

        LET isImageSet = 1

        CALL bt_ui1.SetImage(image_ui)

      END IF

    ON ACTION exit

      EXIT MENU  

  END MENU

END MAIN

lycia form designer

runtime behavior

isImageSet = 0

isImageSet = 1

In the example here, we use ui methods to create a toggle button.

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.