GuidoBMAttributeBrowser
A GuidoBMAttributeBrowser is a special implementation of a GuidoComboBox that is used to select attributes from an open block model. The drop down list when selected will contain all the attributes available from the block model. The GuidoBMAttributeBrowser will understand all the switches that can be used for a GuidoComboBox.
Synopsis
GuidoBMAttributeBrowser Name Body
Description
The GuidoBMAttributeBrowser command when processed will define a rectangular text entry region on the form with a triangle icon on the right that allows the drop down list to be displayed when pressed with the mouse. It accepts any of the standard Guido switches as described for GuidoComboBox.
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 field may contain a number of switches to modify the default behaviour of the field. 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 Any switch that can be used on a GuidoComboBox may be applied to the GuidoBMAttributeBrowser. See the reference for GuidoComboBox for further information.
| -attribute_types list of types | The -attribute_types switch allows you to specify
the types of attributes that will be available in the browsers drop down
list. The attribute types match the type names as described in the block
model reference and must be one or more of: character | real | integer | float | calculated Attributes in the model that do not match the specified types will not be placed into the browsers list. If you do not use this switch all attributes will be placed into the browser list. -attribute_types calculated -attribute_types character integer calculated |
| $fieldName updateBrowserList | The updateBrowserList is not a normal switch and is
refered to as a Guido object method. It must be invoked after the body
of the GuidoBMAttributeBrowser has been defined to actually populate the
list of valid attribute names into the drop down list. The method call
actually takes place at run time just prior to the form being displayed
on the screen. See the example below for further details.
$density updateBrowserList |
Common Guido switches reference
Examples
Example 1
The example form below demonstrates using a number of GuidoBMAttributeBrowser components to get attributes from the currently open block model. Note that you must have an open block model for this example to function correctly.
Notice the use of standard Guido switches and also the use of the GuidoComboBox -exclusive switch. The -attribute_types switch has also been used to filter the list of attributes for each of the browser fields. Finally take note of the Guido method call to updateBrowserList towards the end of the form definition which actually sets the list of attributes into each of the browser lists.
# GuidoBMAttributeBrowser Example 1
# define the form
set formDef {
GuidoForm form {
-label "Using GuidoBMAttributeBrowser"
-default_buttons
GuidoBMAttributeBrowser elementName {
-label "Element attribute"
-width 10
-format none
-null false
-attribute_types character integer calculated
}
GuidoBMAttributeBrowser specficGravity {
-label "SG Attribute"
-width 10
-format none
-null false
-attribute_types real integer calculated
}
GuidoBMAttributeBrowser miningCost {
-label "Mining cost"
-width 10
-exclusive false
-format none
-attribute_types real integer calculated
-null false
}
GuidoBMAttributeBrowser processingCost {
-label "Processing cost"
-width 10
-format none
-exclusive false
-attribute_types real integer calculated
-null false
}
GuidoBMAttributeBrowser volumeAdjust {
-label "Volume Adjustment"
-width 10
-format none
-null true
-attribute_types real integer calculated
}
$elementName updateBrowserList
$specficGravity updateBrowserList
$miningCost updateBrowserList
$processingCost updateBrowserList
$volumeAdjust updateBrowserList
}
}
# Create and run the form
SclCreateGuidoForm formHandle $formDef {}
$formHandle SclRun {}
puts "Selected attributes are:"
puts " - element = $elementName"
puts " - specific gravity = $specficGravity"
puts " - mining cost = $miningCost"
puts " - processing cost = $processingCost"
puts " - volume adjustment = $volumeAdjust"
|