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

GuidoRadioButtonMenuItem and GuidoButtonGroup

Overview

A GuidoButtonGroup provides a multi part menu item by combining a number of GuidoRadioButtonMenuItem's. Each GuidoRadioButtonMenuItem appears as a separate menu item with the current selection noted by a solid dot at the front of the menu item. Only one of the menu items can be selected at any point time.

Synopsis

GuidoRadioButtonMenuItem Name Body

Description

The GuidoRadioButtonMenuItem command when processed will define a menu item which when selected with the mouse or space bar on the keyboard will either 'turn on' or 'turn off'. When 'turned on' a small dot at the front of the menu item will indicate this.

Arguments

Name Name is a unique identifier that you assign and is used to differentiate this object from other Guido objects in the form definition. The name you assign will become the name of a variable in the Tcl interpreter that will contain the value as entered into the field on the form.

Body The body of the radio button may contain a number of switches to modify the default behaviour. The body begins with an opening curly brace and ends with a closing curly brace. If there is no required body the curly braces {} are required as a place holder for this argument.

Switches The following switches can be used to modify the default behaviour of the radio button.

-label textThe -label switch allows you to specify the text that appears inside the menu item
-label "A0"
-label "A4"
-selected_value valueThe -selected_value switch sets the actual value that you want assigned to the radio button group when this button has been selected.
-selected_value "A0"
-selected_value "A4"
-command type functionThe -command switch sets the menu item to perform some action. The command can take one of three types as follows:
  • server - execute a command on the server
  • client - execute a command on the client
  • script - run a tcl script
The function depends upon the type of command. It will either be the name of a server function, the name of a client function, or the pathname to a Tcl script.
-command server "CLEAR GRAPHICS"
-command client "TOGGLE MESSAGE LOG"
-command script "MACROS:grade_control.tcl"

Common Guido switches reference

Synopsis

GuidoButtonGroup Name Body

Description

The GuidoButtonGroup command when processed simply defines a logical collection of radio button menu items. The button group takes on the value of the selected menu item within the group.

Arguments

Name Name is a unique identifier that you assign and is used to differentiate this object from other Guido objects in the form definition. The name you assign will become the name of a variable in the Tcl interpreter that will contain the value as entered into the field on the form.

Body The body of the button group panel may contain a number of switches to modify the default behaviour and GuidoRadioButtonMenuItem definitions. The body begins with an opening curly brace and ends with a closing curly brace. If there is no required body the curly braces {} are required as a place holder for this argument.

Switches 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 GuidoRadioButtonMenuItems that simply print a message regarding the state of the selection to the message window. Unfortunately a GuidoButtonGroup cannot be inserted into a GuidoPopup menu so the logical relationship cannot be shown.

# GuidoRadioButtonMenuItem Example 1
set formDef {
  proc displayState {item} {
    set state [$item getCurrentValue]
    set name [$item getName]
    puts "$name are $state"
  }
  GuidoPopupMenu myMenu {
    GuidoRadioButtonMenuItem faces {
      -label "Faces"
      -default true
      -selected_value "on"
      -unselected_value "off"
      -action mouseReleased {[displayState $faces]}
    }
    GuidoRadioButtonMenuItem edges {
      -label "Edges"
      -selected_value "on"
      -unselected_value "off"
      -action mouseReleased {[displayState $edges]}
    }
    GuidoRadioButtonMenuItem lights {
      -label "Lights"
      -selected_value "on"
      -unselected_value "off"
      -action mouseReleased {[displayState $lights]}
    }
    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