proc isNumeric {x} {
set a [expr ![catch {expr $x*1}]]
if {$a == 0} {
GuidoMessage warning FRM_INVALID_NUMERIC_VALUE $x
}
return $a
}
proc calculateCellsInGrid {} {
global grid_cells
global ystep
global xstep
global ymin
global xmin
global ymax
global xmax
set y_step [$ystep getCurrentValue]
set x_step [$xstep getCurrentValue]
set x_min [$xmin getCurrentValue]
set y_min [$ymin getCurrentValue]
set x_max [$xmax getCurrentValue]
set y_max [$ymax getCurrentValue]
if {[isNumeric $y_step] && [isNumeric $x_step] && [isNumeric $y_min] && [isNumeric $x_min] && [isNumeric $y_max] && [isNumeric $x_max]} {
if {$y_step == "" || $x_step == "" || $y_min == "" || $x_min == "" || $y_max == "" || $x_max == ""}  {
$grid_cells setCurrentValue ""
} else {
set cells [ expr (($y_max - $y_min) / $y_step + 1) * (($x_max - $x_min) / $x_step + 1) ]
$grid_cells setCurrentValue $cells
}
}
}
proc fillTable {} {
global ndesc
global desc_list
set num [$ndesc getCurrentValue]
if {[isNumeric $num]} {
if {$num >= 0} {
$desc_list setInitialRows $num 0 100
}
}
}
GuidoForm frm00131 {
-default_buttons
-label "Create a Grid File"
-action initial {[calculateCellsInGrid]}
-layout BoxLayout Y_AXIS
-action initial {[fillTable]}
-tip 00131_TIP_0
GuidoPanel frm00131_20 {
-layout CentreLineLayout
GuidoFileBrowserField grdname {
-display_length 16
-extension false
-file_mask *.grd
-format none
-label "Grid name"
-max_length FIO_MAX_FILENAME_LENGTH
-tip 00131_TIP_1
-translate none
}
}
GuidoFiller frm00131_21 {
-height 0.2
}
GuidoPanel frm00131_25 {
-layout BoxLayout Y_AXIS
-border etched true
GuidoPanel frm00131_25 {
-layout BoxLayout X_AXIS
GuidoPanel frm00131_22 {
-layout CentreLineLayout
GuidoFiller frm00131_26 {}
GuidoLabel frm00131_3 {
-label "Step size"
}
GuidoField ystep {
-display_length 6
-format double
-high_bound 999999
-label Y
-low_bound 0.1
-max_length 16
-action valueChanged {[calculateCellsInGrid]}
-next_focus ymin
-null false
-tip 00131_TIP_2
-translate upper
}
GuidoField xstep {
-display_length 6
-format double
-high_bound 999999
-action valueChanged {[calculateCellsInGrid]}
-label X
-low_bound 0.1
-max_length 16
-next_focus xmin
-null false
-tip 00131_TIP_5
-translate upper
}
}
GuidoFiller frm00131_27 {
-width 1
}
GuidoPanel frm00131_23 {
-layout BoxLayout Y_AXIS
GuidoLabel frm00131_4 {
-label Minimum
}
GuidoField ymin {
-display_length 6
-format double
-max_length 16
-action valueChanged {[calculateCellsInGrid]}
-next_focus ymax
-null false
-tip 00131_TIP_3
-translate upper
}
GuidoField xmin {
-display_length 6
-format double
-max_length 16
-action valueChanged {[calculateCellsInGrid]}
-next_focus xmax
-null false
-tip 00131_TIP_3
-translate upper
}
}
GuidoFiller frm00131_27 {
-width 1
}
GuidoPanel frm00131_24 {
-layout BoxLayout Y_AXIS
GuidoLabel frm00131_5 {
-label Maximum
}
GuidoField ymax {
-display_length 6
-format double
-max_length 16
-action valueChanged {[calculateCellsInGrid]}
-next_focus xstep
-null false
-tip 00131_TIP_4
-translate upper
}
GuidoField xmax {
-display_length 6
-format double
-max_length 16
-action valueChanged {[calculateCellsInGrid]}
-null false
-tip 00131_TIP_4
-translate upper
}
}
GuidoFiller frm00131_27 {
-width 1
}
}
GuidoFiller frm00131_28 {
-height 0.5
}
GuidoPanel frm00131_35 {
-layout BoxLayout X_AXIS
GuidoLabel grid_label {
-label "Number of nodes in grid"
-display_length 11
}
GuidoLabel grid_cells {
-display_length 11
}
}
}
GuidoFiller frm00131_28 {
-height 0.5
}
GuidoPanel frm00131_35 {
-layout BoxLayout Y_AXIS
-border etched true
GuidoPanel frm00131_31 {
-layout CentreLineLayout
GuidoField lendesc {
-display_length 10
-format integer
-high_bound 512
-label "Length of description field"
-low_bound 32
-max_length 3
-null false
-tip 00131_TIP_6
-translate none
}
GuidoField ndesc {
-display_length 10
-format integer
-high_bound 100
-label "Number of description fields"
-low_bound 0
-action valueChanged {[fillTable]}
-max_length 3
-null false
-tip 00131_TIP_7
-translate none
}
GuidoComboBox zopt {
-label "Initialise option for Z values"
-format none
-max_length 16
-null false
-value_in Null "LPS_LP_OPT_RANDOM" Fixed
}
}
GuidoFiller frm00131_27 {
-height 0.2
}
GuidoPanel frm00131_32 {
-layout CentreLineLayout
GuidoField fixed_z_value {
-dependency {"[ $zopt getCurrentValue]" != "Random" && "[ $zopt getCurrentValue]" != "Null"}
-label "Define fixed Z value for grid"
-display_length 10
-format double
-max_length 16
-input true
-null false
-translate none
}
GuidoField rfrom {
-dependency {"[ $zopt getCurrentValue]" != "Fixed" && "[ $zopt getCurrentValue]" != "Null"}
-label "Minimum Z value for grid"
-display_length 10
-format double
-max_length 16
-input true
-null false
-translate upper
}
GuidoField rto {
-dependency {"[ $zopt getCurrentValue]" != "Fixed" && "[ $zopt getCurrentValue]" != "Null"}
-label "Maximum Z value for grid"
-display_length 10
-format double
-max_length 16
-input true
-null false
-translate upper
}
}
}
GuidoFiller frm00131_29 {
-height 0.5
}
GuidoPanel table_panel {
-label "Define initial values for the description fields"
-border etched true
-layout CentreLineLayout
GuidoScrollPane desc_values {
-height 10
-width 22
GuidoTable desc_list {
-instances 0 1 100
-interactive true
GuidoField desc_values {
-display_length 17.5
-input true
-null true
-label Values
-max_length 32
}
}
}
}
}
