Chapter Contents

Previous

Next
POPMENU

POPMENU



Displays a pop-up menu that contains character items from an SCL list

Category: List


Syntax
Details
Example
See Also

Syntax

index=POPMENU(list-id<,max-popup<,row,column>>);

index
specifies the index of the item to be selected by default when the pop-up menu appears. On return, index will be set to the index of the selected pop-up menu item.

Type: Numeric

list-id
is the identifier of the list that contains the character or list items to display in the pop-up menu. An invalid list-id produces an error condition.

Type: Numeric or List

Lists may contain sublists as items. These list items must include one or more of the following named items to be valid:

Text
specifies the menu text (required).

Type: Character

Checked
specifies whether a check should appear to the left of the item. Valid values are Yes|No (Default).

Type: Character

Classifier
specifies the numeric representation of an icon to be associated with the menu item.

Type: Numeric

Grayed
specifies whether the menu item should be grayed. Valid values are Yes|No (Default).

Type: Character

HelpText
is the text to display on the status line.

Type: Character

Mnemonic
specifies the character that is used as a keyboard shortcut. The character must be one of the characters of the menu text.

Type: Character

max-popup
is the maximum number of items to display in a pop-up menu window. If the list is longer than max-popup, the menu is displayed in a window with a scrollable listbox.

Type: Numeric

row
is the starting row of the pop-up menu.

Type: Numeric

column
is the starting column of the pop-up menu.

Type: Numeric


Details

If the list contains too many items to fit in a pop-up menu, POPMENU displays the choices in a list box that includes scrollbars. If no display window is available, POPMENU always puts the menu in a list box.

An item in the list that has the INACTIVE attribute cannot be selected and is grayed on devices that support graying. However, it is still displayed in the menu. You can use SETLATTR to assign the INACTIVE attribute to an item or to restore the item to an ACTIVE state.

If the pop-up menu is displayed in a list box, inactive items are marked with a dash, indicating that they may not be selected.

To display a separator on the pop-up menu, insert a dash as a character item in the list where you would like the separator to appear.

To display a dash, add a space before or after the dash to prevent the text from being interpreted as a separator.

POPMENU returns 0 if

In the last three cases, the pop-up menu is not displayed.

If row and column are specified and either is outside the boundaries of the current window, the pop-up menu is positioned elsewhere on the window.

Note:   Some window systems do not allow row and column positioning of pop-up menus. They may appear at the position where the pointing device was last clicked.  [cautionend]


Example

Display a pop-up menu when the user presses enter. Initialize the pop-up menu with three menu items: Select 1, Numeric, and Character. Define a separator between Select 1 and Numeric.

init:
  dcl list ;
  control enter;
  list = { {text='Select 1',
              helpText='This is a selection.',
              mnemonic='S',
              classifier = 107},
          "-",
          "Numeric",
          "Character"};

   return;
main:
 rc= popmenu (list);
 put rc=;
 return;

term:
/* Delete the list recursively to avoid memory leak */
rc = dellist ( list, 'y;);
return;

See Also

FILLIST

SETLATTR


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.