You are here: Surpac Concepts > Macros > SCL > GUIDO > GuidoPopupMenu
GEOVIA Surpac

GuidoPopupMenu

Overview

A GuidoPopupMenu is a container object that can hold any number of GuidoMenuItems, GuidoCheckBoxMenuItems, GuidoRadioButtonMenuItems, and GuidoSeparators. Popup menus are normally used on advanced forms that contain GuidoTrees where functionality for the user to perform different tasks is required.

The GuidoPopupMenu definition is defined within the same Guido script that contains the form definition. It is associated with certain widgets on the form such that a right mouse button click will display it. See the example below or the examples for GuidoTree.

Synopsis

GuidoPopupMenu Name Body

Description

The GuidoPopupMenu command when processed will define a logical grouping of menu items for display. When displayed it appears as a popup window with the menu items shown in it.

Arguments

Name Name is a unique identifier that you assign and is used to differentiate this object from other Guido objects in the menu definition.

Body The body of the popup menu contains all the menu items that make it up. There are no specific switches used to modify the popup menu.

Switches The following switches can be used to modify the default behaviour of the popup menu.

Common Guido switches reference

Examples

Example 1

The example form below contains a button that will invoke a popup menu. The popup menu contains a number of GuidoMenuItems that simply print a message to the message window. See example 2 of GuidoTree for a more realistic example.

# GuidoMenuItem Example 1
set formDef {
  GuidoPopupMenu myMenu {
    GuidoMenuItem add {
      -label "New"
      -action mouseReleased {[puts "The add menu item was pressed"]}
    }
    GuidoMenuItem rename {
      -label "Rename"
      -action mouseReleased {[puts "The rename menu item was pressed"]}
    }
    GuidoMenuItem delete {
      -label "Delete"
      -action mouseReleased {[puts "The delete menu item was pressed"]}
    }
    GuidoSeparator sep {}
    GuidoMenuItem exit {
      -label "Exit"
      -action mouseReleased {[$myMenu setVisible false]}
    }
  }
  GuidoForm form {
    -label "Using Menu Components"
    -default_buttons
    -layout BoxLayout Y_AXIS
    GuidoFiller fil1 {
      -height 1
    }  
    GuidoButton button {
      -caption "Press for Popup menu"
      -width 25
      -action valueChanged {[$myMenu setVisible true]}
    }
    GuidoFiller fil1 {
      -height 1
    }  
  }
}
# Create and run the form
SclCreateGuidoForm formHandle $formDef {}
$formHandle SclRun {}
      

 

See Also

Guido
GuidoForm
Common guido switches
GuidoButtonGroup
GuidoCheckBoxMenuItem
GuidoMenuItem
GuidoRadioButtonMenuItem
GuidoSeparator
GuidoMenu
GuidoMenuBar
GuidoPopupMenu
Guido action events and callbacks