At Sun, 19 Feb 2023 03:15:50 -0800 (PST) snosniv <
[email protected]> wrote:
I have the following code which works fine to generate 10 rows of entries/checkboxes, so I get 50 parameters.
I have to pass all these params to a procedure, is there a better way than listing ALL 50 in the call/proc?
Generate code is:-
##-----------------------------------------------------------------------------
## Labels & Entry for MultiBlock Rows 1 to 10 ##-----------------------------------------------------------------------------
## Grid placement for all the rows ##-----------------------------------------------------------------------------
for {set xxx 0} {$xxx < 10} {incr xxx} {
label $f4a.lb_TIM_$xxx -text "Time" -font {Arial 8 bold} -background white -foreground black
label $f4a.lb_SPC_$xxx -text " " -font {Arial 8 bold}
entry $f4a.enMINS_$xxx -textvar MB_mins_$xxx -width 2 -validate all -vcmd {ValidInt %P}
entry $f4a.enSECS_$xxx -textvar MB_secs_$xxx -width 2 -validate all -vcmd {ValidInt %P}
entry $f4a.enPWR_$xxx -textvar MB_power_$xxx -width 3 -validate all -vcmd {ValidInt %P}
entry $f4a.enCAD_$xxx -textvar MB_cad_$xxx -width 3 -validate all -vcmd {ValidInt %P}
checkbutton $f4a.cbSEL_$xxx -var MB_sel_$xxx -background white -foreground red
grid $f4a.lb_TIM_$xxx -row [expr $xxx + 1] -column 0
grid $f4a.enMINS_$xxx -row [expr $xxx + 1] -column 1
grid $f4a.lb_SPC_$xxx -row [expr $xxx + 1] -column 2
grid $f4a.enSECS_$xxx -row [expr $xxx + 1] -column 3
grid $f4a.enPWR_$xxx -row [expr $xxx + 1] -column 4
grid $f4a.enCAD_$xxx -row [expr $xxx + 1] -column 5
grid $f4a.cbSEL_$xxx -row [expr $xxx + 1] -column 6
}
Any help much appreciated.
Kev P.
Why did you repost this?
Rich suggested bundling the parameters into a list or lists or into a matrix.
I suggested that since the params are all in globals, you don't have to pass them at all, just reference the globals. Alternitivly, you can replace the individual globals with a single global array variable.
--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
[email protected] -- Webhosting Services
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)