10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Build a Frame DynamicallyHow You Can Construct a File Menu GroupThe following discussion steps through the construction of the File menu group.1. Create the MenuGroup object:top_menu = MenuGroup.Create(); /* File Menu */2. Define the TextLabel and internal name for the File menu group:top_menu.TextLabel = 'File';top_menu.Name = 'file_menu';The text assigned to the TextLabel attribute is displayed by the frame in itsMenu bar. The preceding code, therefore, causes the word "File" to appearas one of the selections available in the frame's initial menu. The valueassigned to the Name attribute is the name of the reference variablepointing to that MenuGroup object.3. Define the two submenu options that appear when the user selects the Fileoption from the Menu bar: “Commit and Close” and “Rollback and Close.”Defining these operations follows the same procedures as creating theMenuGroup:• Create the object for each item (in this case a MenuButton object).• Define the TextLabel and Name for each menu item.The following code creates the first submenu item:test_menu = MenuButton.Create();test_menu.Name = 'commit_menu';test_menu.TextLabel = 'Commit and Close';4. In addition to letting the user to commit the transaction and close theframe by selecting the Commit menu button, the dynamic frame providesa second way to commit and close. The example frame providesalternative access to the Commit operation by defining a speed key, whichlets the user select the Close operation from the keyboard rather thanusing the mouse.The following code defines the speed key:test_menu.SpeedKey = SK_CLOSE;5. After each submenu option is defined, the following code attaches it to theField MenuGroup object:test_menu.ParentMenuGroup = top_menu;The preceding statement makes the MenuGroup object represented bytop_menu to be the parent of the MenuButton object represented bytest_menu.412 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!