MenuBar

Form and theme XML code and CSS element selector

Inheritance diagram

Most commonly used form and theme properties

Associated ui methods

Influence and behavior

MenuBar is a widget that contains menu groups and is used to create the application's drop-down menus.

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

MenuBar without content as seen in Lycia Form Designer:

Form XML code:

<MenuBar title="Menu bar" visible="true" identifier="c1"/>

Theme element filter XML code:

<ElementFilter ElementName="MenuBar">

  ...

</ElementFilter>

CSS element selector code:

ui-menubar

Inheritance diagram:

Most commonly used form properties:

classnames

identifier

Most commonly used theme properties:

Font:

New Font

Family

Bold  

Italic

Underline

Font Size

Fore Color

Cursor

Associated ui methods:

ForName

SetMenuItems

GetMenuItems

Influence and behavior:

You cannot have more that one menubar in your application. However, you can have several menu groups in your only menubar.

Menubar has a reserved place in a window. You cannot place a MenuBar anywhere you want - only to its reserved location.

To add a MenuBar to your form,

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

Step 2. Move the cursor and drop the MenuBar to your form.

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

Step 4. Populate the MenuBar with MenuGroups and MenuCommands.

MenuBar can hold both MenuGroups and MenuCommands.

 

At runtime, you can populate menubars with ui methods.

For this purpose, you

  1. create an .fm2 form that hat a root container and a MenuBar,
  2. bind this menubar to the variable of the ui.MenuBar datatype:

    LET menu_var =ui.MenuBar.ForName("mb1")

Now you can populate the MenuBar with menu groups as shown in the example program.

 

As a container, MenuBar is hardly customizable.

You can use css to change the color on the menubar or change the font and cursor via Lycia Theme Designer but most other formatting must be applied directly to menu groups and menu commands.

property applied in the user theme:

theme XML code:

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

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

  <ElementFilter ElementName="MenuBar">

    <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:

.ui-menubar.ui-widget-header {

background-color: teal;

}

runtime behavior:

 

 

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.