Working With Menu Bars

Contents

Creating a Menu Bar and Displaying Its Resources

When you create an application through Cosmo Code, a menu bar containing File and Edit is automatically added to your frame.

The Resources card displays the Menu editor in the left panel and the menu bar's resources in the right panel. For information on modifying resources, see Modifying Object Attributes and Geometry.

Things to keep in mind:


Relabeling an Item

Note: You cannot relabel the top level item labeled "menubar". You can change its Instance name in the right panel.

  1. In the Menu editor, select the item.

    Hint: Click in the text; selecting the bullet gives you a selection highlight, but not an edit field.

  2. Type a new label.

    The change takes effect when you:


Adding an Item

  1. In the Menu editor, click an existing item.

  2. Press <Enter>, or choose Edit > Add Item.

    Cosmo Code creates a blank space below the selected item, and creates new items at the same level as the selected item, preserving the selected item's submenus and items.

  3. Type the new item label.

    The change takes effect when you:

    Note: If you move the mouse outside of the Menu editor before typing a label, Cosmo Code removes the blank space.


Moving an Item

Items can be indented right or left and moved up or down. Moved menus take their submenus and items with them.

Moving an Item Right or Left

Indented menus become items. If they have items indented below them, they become submenus.

Moving an Item Up or Down

Note: Cosmo Code bases the move by the location of the cursor. If your cursor is in the item label and not the bullet when you move down or up, Cosmo Code indents the item as well as moves it.


Adding a Checkbox to a Menu Item

A checkbox can precede menu items and not menus.

  1. In the Menu editor, click in a menu item.

    The right panel of the Resources card updates showing the object's resources.

  2. Select Checkbox as the Menu item type.


Creating a Separator


Deleting an Item

If you delete a menu, its submenus and items are moved up and are outdented.

Note: If you delete the menu bar, you cannot recreate it. You can undo the deletion as long as you do so before exiting the visual builder.


Adding Behavior to a Menu Item

Behavior is added to menu items and not menus.

  1. In the Menu editor, click a menu item.

    The right panel of the Resources card updates showing the object's resources.

  2. Assign an event handler to the actionPerformed for 1.1 events or ACTION_EVENT for 1.0.2 events.

    For information on working with event handlers, see Handling Events.

Guide to the Cosmo Code Development Environment
12-96*525