set form_displayed 0
proc labels_decimals_allowed {table_name label_fld dp} {
set field_name [$label_fld getCurrentValue]
if {$table_name == ""} {
$dp setCurrentValue ""
$label_fld setCurrentValue ""
return 0
}
if {$field_name != ""} {
set buffer [GuidoExecServer GetFieldInformation [subst {DatabaseType = "GeologyDatabase" SurpacTableName = $table_name SurpacFieldName = $field_name}]]
set FieldType [GuidoGetParamBufferValue $buffer FieldType]
if {$FieldType == "real"} {
if {[$dp getCurrentValue] == ""} {
$dp setCurrentValue 2
}
return 1
}
$dp setCurrentValue ""
return 0
}
$dp setCurrentValue 2
return 1
}
proc labels_minValue_allowed {table_name label_fld label_minValue} {
set field_name [$label_fld getCurrentValue]
if {$table_name == ""} {
$label_minValue setCurrentValue ""
$label_fld setCurrentValue ""
return 0
}
if {$field_name != ""} {
set buffer [GuidoExecServer GetFieldInformation [subst {DatabaseType = "GeologyDatabase" SurpacTableName = $table_name SurpacFieldName = $field_name}]]
set FieldType [GuidoGetParamBufferValue $buffer FieldType]
if {$FieldType == "character"} {
if {[$label_minValue getCurrentValue] != ""} {
$label_minValue setCurrentValue ""
}
return 0
}
return 1
}
}
proc validateExtents {label_minValue label_maxValue} {
set min [$label_minValue getCurrentValue]
set max [$label_maxValue getCurrentValue]
if {$min == "" || $max == ""} {
return true
}
if {$min >= $max} {
GuidoMessage warning MINVAL_GRTR_MAXVAL_ERR
return false
} else {
return true
}
return true
}
proc labels_maxValue_allowed {table_name label_fld label_maxValue} {
set field_name [$label_fld getCurrentValue]
if {$table_name == ""} {
$label_maxValue setCurrentValue ""
$label_fld setCurrentValue ""
return 0
}
if {$field_name != ""} {
set buffer [GuidoExecServer GetFieldInformation [subst {DatabaseType = "GeologyDatabase" SurpacTableName = $table_name SurpacFieldName = $field_name}]]
set FieldType [GuidoGetParamBufferValue $buffer FieldType]
if {$FieldType == "character"} {
if {[$label_maxValue getCurrentValue] != ""} {
$label_maxValue setCurrentValue ""
}
return 0
}
return 1
}
}
GuidoScript scripts/geologyutilities.tcl
global label_tick_length
global label_table
global label_tbl
global label_fld
global label_position
global label_alignment
global label_offset
global label_combine
global label_decimals
global label_use_styles
global label_colour
global label_font_style
global label_font_size
global label_font_units
global label_minValue
global label_maxValue
GuidoPanel labels_panelb {
-layout BoxLayout Y_AXIS
GuidoPanel top {
-layout CentreLineLayout
GuidoField label_tick_length {
-label "Tick length"
-decimals 1
-display_length 4
-format double
-max_length 8
-null false
-default 1.0
-tip DB_LABELS_TICK_LEN_TIP
}
}
GuidoFiller attributes_filler_1 {
-height 1
}
GuidoPanel borderLayout {
-layout borderlayout
GuidoScrollPane scroller {
-width 71
GuidoTable label_table {
-position centre
-instances 1 0 200
-interactive true "insert|remove|add"
GuidoDatabaseTableBrowser label_tbl {
-display_length 5
-action valueChanged {[updateTableName $label_fld $label_tbl]}
-label "Table"
-database dbHandle
-table_types "interval | point"
-null true
-exclusive true
-tip DB_LABELS_TBL_TIP
}
GuidoTableFieldBrowser label_fld {
-display_length 5
-label "Field"
-format string
-null false
-exclusive true
-database dbHandle
-tip DB_LABELS_FLD_TIP
-dependency {"[$label_tbl getCurrentValue]" > ""}
}
GuidoComboBox label_position {
-label "Position"
-display_length 3
-exclusive true
-null false
-max_length 5
-value_in left right
-default right
-tip DB_LABELS_POSITION_TIP
}
GuidoComboBox label_alignment {
-label "Alignment"
-display_length 3
-exclusive true
-null false
-max_length 5
-value_in left centre right
-default left
-tip DB_LABELS_ALIGN_TIP
}
GuidoField label_offset {
-label "Offset"
-decimals 1
-display_length 3
-format double
-max_length 8
-null false
-default 1.0
-tip DB_LABELS_OFFSET_TIP
}
GuidoCheckBox label_combine {
-default true
-font_style bold
-label "Combine"
-selected_value true
-unselected_value false
-tip PLT_SAMPLE_FIELDS_COMBASS_TIP
}
GuidoField label_decimals {
-dependency {"[labels_decimals_allowed [$label_tbl getCurrentValue] $label_fld $label_decimals]"}
-label "Decimals"
-display_length 4
-format integer
-max_length 8
-null false
-tip DB_LABELS_DP_TIP
}
GuidoCheckBox label_use_styles {
-default true
-font_style bold
-label "Use styles"
-selected_value false
-unselected_value true
-tip DB_LABELS_STYLES_TIP
}
GuidoColourBrowserField label_colour {
-label "Colour"
-display_length 6
-exclusive false
-max_length 32
-dependency {"[$label_use_styles getCurrentValue]"}
-tip DB_LABELS_COLOUR_TIP
}
GuidoFontNameBrowser label_font_style {
-label "Font"
-default Default
-display_length 8
-format none
-max_length 30
-tip DB_LABELS_FONT_TIP
}
GuidoField label_font_size {
-label "Size"
-decimals 3
-display_length 3
-format double
-max_length 8
-null false
-default 1.0
-tip DB_FONT_SIZE_TIP
}
GuidoComboBox label_font_units {
-label "Units"
-default oru
-display_length 1
-format none
-max_length 3
-null false
-value_in oru sru
-tip DB_FONT_SIZE_TIP
}
GuidoField label_minValue {
-dependency {"[labels_minValue_allowed [$label_tbl getCurrentValue] $label_fld $label_minValue]"}
-label "Minimum value"
-decimals 3
-display_length 3
-format double
-max_length 8
-null true
-default 0.0
-validation {[validateExtents $label_minValue $label_maxValue]}
-tip DB_MIN_VALUE_TIP
}
GuidoField label_maxValue {
-dependency {"[labels_maxValue_allowed [$label_tbl getCurrentValue] $label_fld $label_maxValue]"}
-label "Maximum value"
-decimals 3
-display_length 3
-format double
-max_length 8
-null true
-default 0.0
-validation {[validateExtents $label_minValue $label_maxValue]}
-tip DB_MAX_VALUE_TIP
}
}
}
}
$label_font_style updateBrowserList
}
$labels_panel add [eval "\$labels_panelb getObject"]
$label_fld setDependency {[updateTableName $label_fld $label_tbl]}
$label_fld setActionCallback focusGained {[ updateTableName $label_fld $label_tbl ]}
$label_fld setValidationCallback {[validateTableFieldPair $label_tbl $label_fld]}
set databuf [ GuidoExecServer GetHoleLabels {} ]
set status [GuidoGetParamBufferValue $databuf status]
if {$status >= 0} {
set num_rows [GuidoGetParamBufferValue $databuf "num_rows"]
$label_tick_length setCurrentValue [GuidoGetParamBufferValue $databuf "tick_length"]
if {$num_rows > 0} {
$label_table setInitialRows $num_rows 0 200
} else {
$label_fld setInputAllowed 0 false
$label_decimals setInputAllowed 0 false
$label_colour setInputAllowed 0 false
}
for {set i 0} {$i < $num_rows} {incr i} {
$label_tbl setCurrentValue $i [GuidoGetParamBufferValue $databuf "tbl($i)"]
$label_fld setCurrentValue $i [GuidoGetParamBufferValue $databuf "fld($i)"]
$label_font_style setCurrentValue $i [GuidoGetParamBufferValue $databuf "font_style($i)"]
$label_font_size setCurrentValue $i [GuidoGetParamBufferValue $databuf "font_size($i)"]
$label_font_units setCurrentValue $i [GuidoGetParamBufferValue $databuf "font_units($i)"]
$label_position setCurrentValue $i [GuidoGetParamBufferValue $databuf "position($i)"]
$label_offset setCurrentValue $i [GuidoGetParamBufferValue $databuf "offset($i)"]
$label_colour setCurrentValue $i [GuidoGetParamBufferValue $databuf "colour($i)"]
$label_alignment setCurrentValue $i [GuidoGetParamBufferValue $databuf "alignment($i)"]
$label_combine setCurrentValue $i [GuidoGetParamBufferValue $databuf "combine($i)"]
$label_minValue setCurrentValue $i [GuidoGetParamBufferValue $databuf "minValue($i)"]
$label_maxValue setCurrentValue $i [GuidoGetParamBufferValue $databuf "maxValue($i)"]
if {[GuidoGetParamBufferValue $databuf "decimals($i)"] >= 0} {
$label_decimals setCurrentValue $i [GuidoGetParamBufferValue $databuf "decimals($i)"]
$label_decimals setInputAllowed $i true
} else {
$label_decimals setCurrentValue $i ""
$label_decimals setInputAllowed $i false
}
if {[GuidoGetParamBufferValue $databuf "colour($i)"] > ""} {
$label_use_styles setCurrentValue $i true
$label_colour setInputAllowed $i true
} else {
$label_use_styles setCurrentValue $i false
$label_colour setInputAllowed $i false
}
}
}
$label_tbl updateBrowserList
