Using functions and variables

You can use functions and variables in your scripts.

Using functions

PowerBuilder provides built-in functions that act on menu items. You can use these functions in scripts to manipulate menu items at runtime. For example, to hide a menu, you can use the built-in Hide function.

For a complete list of the menu-level built-in functions, look at the Function List view or use the Browser.

NoteDefining menu-level functions You can define your own menu-level functions to make it easier to manipulate your menus. One way you can do this is in the Function List view, by selecting Add from the pop-up menu.

For more information, see Chapter 8, “Working with User-Defined Functions.”

Using variables

Scripts for menu items have access to all global variables declared for the application. You can also declare local variables, which are accessible only in the script where they are declared.

You can declare instance variables for the menu when you have data that needs to be accessible to scripts in several menu items in a menu. Instance variables are accessible to all menu items in the menu.

For a complete description of variables and how to declare them, see the PowerScript Reference.

Defining menu-level structures

If you need to manipulate a collection of related variables, you can define menu-level structures using the Structure view. You do this by displaying the Structure List view and then selecting Add from the pop-up menu. The Structure and Structure List views are not part of the default layout.

For more information, see Chapter 10, “Working with Structures.”