Chapter Contents


Widget Class: _popup

Widget Class: _popup

Displays a pop-up menu containing character items in an SCL list



objectName._popup( itemsList, selection );

Argument Type Use Description
itemsList Numeric Update specifies the identifier of a list containing items to display in the pop-up
selection Numeric Output returns the index number of the selection made from the pop-up menu


The _popup method is enabled when

When the _popup method is enabled, it is automatically invoked when the object receives a pop-up menu event. The list passed to the _popup method is allocated for you and is initially empty. As the _popup method is passed up the class hierarchy, each SUPER class can modify the list (such as adding or removing items or making items inactive).

If there is not an owning object, the _childPopup method is invoked on the Frame object. There are currently five owning objects for Frame entries:

After the pop-up menu list displays, selection contains the selected pop-up menu item. If that selection belongs to this method, the selection should be handled and selection should be set to 0 before returning. The list should also be cleaned up (for example, removing items that were added, adding items that were removed, and making items active). It is important that the list and selection returned from this method be consistent with the list that was passed into the method as illustrated in the example.


This example adds three items to the beginning of the list and then handles the selection of the item:

length _method_ $40;

 method list sel 8;
  /* Insert three items on the front of the pop-up menu list. */

 rc = insertc(list, "Edit", 1);
 rc = insertc(list, "Copy", 2);
 rc = insertc(list,"Remove", 3);

  /* CALL SUPER invokes the current method, _popup, and */
  /* displays the list. */
 _super_._method('list', 'sel');

 /* Delete the three items from the */
 /* list so they are not passsed to child subclasses. */
 rc = delitem(list, 1);
 rc = delitem(list, 1);
 rc = delitem(list, 1);

  /* SEL was set by the CALL SUPER; */
  /* check if the selection is one */
  /* of the items that was added. */
 if (sel > 0) then

    /* Since the three added items were added at */
    /* the beginning of the list, SEL must be 1, */
    /* 2, or 3 if one of the items was selected. */
   if (sel <= 3) then
       if (sel = 1) then
       else if (sel = 2) then
       else /* sel must be 3 */

        /* set 'sel' to 0 to */
        /* indicate selection was handled */
      sel = 0;

   /* The selection was not one of the items */
   /* that was added; however, since the three */
   /* items were added at the beginning, */
   /* subtract 3 from the selection. */
     sel = sel - 3;

In this example selection is checked for greater than 0 before any work is done. This is to allow a Super class to handle the selection first and have it set selection to 0 if it handled the selection (selection is set to 0 in this example when the selection is handled).

Note that 3 is subtracted from selection if the selection was not one of the items that was added. Therefore, no subclasses are affected when a Super class adds items to the list. For example, if a class added three items to the beginning of the list, the expected value of selection would be 1, 2, or 3 when one of those items is selected. However, if a Super class also added three items to the beginning of the list, that would have the effect of pushing the three previous items further down the list, thus making a selection of item 4, 5, or 6.

Chapter Contents



Top of Page

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