MenuCommand

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

MenuCommand is the actual menu option that can be invoked by the user.

Do not mix up menus created in Lycia Form Designer from MenuBars, MenuGroups, and MenuCommands, with menus created by the MENU statement.

Form XML code:

<MenuCommand text="Menu command" visible="true" identifier="mc1">

  <MenuCommand.onInvoke>

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

  </MenuCommand.onInvoke>

</MenuCommand>

Theme element filter XML code:

<ElementFilter ElementName="MenuCommand">

  ...

</ElementFilter>

CSS element selector code:

.qx-aum-menu-command

Inheritance diagram:

Most commonly used form properties:

classnames

enable

onInvoke

identifier

text

Most commonly used theme properties:

Background

New Background

Fill Color

Background Image

Background Style

Size

Location

Font:

New Font

Family

Bold

Italic

Underline

Font Size

Fore Color

Image Id

Margin

Padding

Associated 4gl syntax:

ON ACTION

COMMAND

Associated ui methods:

Create

ForName

SetText

GetText

SetImageId

GetImageId

SetShortCut

GetShortCut

SetOnInvoke

GetOnInvoke

SetIsChecked

GetIsChecked

Influence and behavior:

Menus have a reserved place in a window. You cannot place a MenuCommand anywhere you want - you can only insert it to a MenuGroup.

To add a MenuCommand to your form,

Step 1. Choose a MenuCommand in the widgets palette by left-clicking its icon.

Step 2. Move the cursor and drop the MenuCommand to the selected MenuGroup.

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

You can add MenuCommands to MenuGroups or directly to a MenuBar.

Once added, you can move the menu commands between menu groups or change their order in a menu group:

 

Most commonly used form properties of a menu command are text, classnames, identifier, and onInvoke.

Here you can find out how to change the text of the menu command in Lycia Form Designer:

Here you can find out how to change the widget text at runtime using ui methods.

 

To allow user communication with your menu commands, you must set actions to them using ON ACTION or COMMAND clauses:

MENU

  ON ACTION "act1"

    DISPLAY "This action was triggered by the menu command 'One'."

  ...

END MENU

Try the example programs - menucommand and menu - to learn more about working with menu commands.

 

At runtime, you create and manipulate menu commands with ui methods.

To create a menu command,

You can also use ui methods to change properties of a menu command:

CALL menucommand.setText("My new command")

CALL menucommand.SetImageId("qx://application/bookmark.svg")

CALL menucommand.SetShortCut("F2")

Try the example programs - menucommand_ui and menu_ui - to learn how to create dynamic menus at runtime.

 

You can change the appearance of a menu command master and user themes and/or css styles.

property applied in the user theme:

theme XML code:

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

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

  <ElementFilter ElementName="MenuCommand">

    <StyleSheet>

      <DoStyleAction>

        <SetProperty>

          <PropertyPath>

            <PropertyName>Background</PropertyName>

            <PropertyName>FillColor</PropertyName>

          </PropertyPath>

          <PropertyValue type="CustomizedColor" RedColor="0" GreenColor="128" BlueColor="128" Alpha="255" />

        </SetProperty>

      </DoStyleAction>

    </StyleSheet>

  </ElementFilter>

</StyleSheet>

or

css code:

.qx-aum-menu-command {

background-color: teal;

}

runtime appearance:

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.