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 DynamicallyTo create a menu for your frame, you would perform the following basic steps:1. Create the MenuBar object, assigning it to the StartMenu attribute of theFrameSource.2. Create the menu groups that make up the menu bar. For each:• Create the MenuGroup object.• Define its TextLabel attribute. This becomes the initial menu item thatappears on the menu bar.For example, assume that you create two menu groups and assign thevalue File to the TextValue attribute of one and Edit to the TextValueattribute of the other. After you attach these menu groups to a menubar, the menu bar presents the selections File and Edit to the user.• Create the menu objects that make up the menu group, set theirattributes, and attach them to the menu group.3. Attach the completed menu group to the menu bar.To attach a menu object to a menu group or a menu group to the menubar, set the object's ParentMenuGroup attribute. Setting this attributeattaches the specified MenuGroup, MenuItem, or MenuSeparator to aspecified menu.For example, the DynamicFrame frame uses the reference variabletest_menu to hold the individual MenuButton objects as they are created.After they have been created and named, they are attached to theMenuGroup object represented by top_menu:test_menu.ParentMenuGroup = top_menu;In effect, the preceding statement says that the menu button representedby test_menu is part of the menu group represented by top_menu. For anexample of how to create menu items dynamically, see How You CanCreate the Frame Menu Items (see page 411).How You Can Create the ScriptA frame's script is contained in the Script attribute of its FrameSource object.The data type of this attribute is StringObject. The first step to building a scriptfor a frame is creating a string object and assigning it to the Script attribute ofthe frame's FrameSource object.After you have created the string object, use the ConcatVarchar method to putthe text into your script. This method appends text to a StringObject. Thesyntax of the ConcatVarchar method is:StringObject = StringObject.ConcatVarchar(text = varchar)The ConcatVarchar method returns a reference to the original string.Creating a Frame at Runtime 395

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

Saved successfully!

Ooh no, something went wrong!