
# This code creates the ICEM CFD Manager.
#
# Copyright (c) 1993 - 1996 Pacific Marketing and Consulting, Inc,
#       and ICEM Systems, GmbH.  All rights reserved.
# Author:  Wayne A. Christopher, wayne@icemcfd.com

# Pick some items from a set, but using an array of selection buttons.

proc putarray {w list} {
	global helpCmds

	set num [llength $list]
	if {$num < 150} {
		set pfont ""
		set maxcols 8
	} else {
		set pfont "-font 6x10"
		set maxcols 12
	}

	if {$num <= 10} {set cols 1}
	if {($num > 10) && ($num <= $maxcols * $maxcols)} \
		{set cols [expr {$num / $maxcols + 1}]}
	if {$num > $maxcols * $maxcols} {set cols $maxcols}

	for {set i 0} {$i < $cols} {incr i} {
		frame $w.$i -borderwidth 0 -relief flat
		pack append $w $w.$i {left fill expand}
		set helpCmds($w.$i) "set topic $w"
	}

	set i 0
	foreach e $list {
		set c [expr {$i % $cols}]
		eval label $w.$c.$i -width 3 $pfont -borderwidth 1 \
			-relief raised -text \"$e\"
		set helpCmds($w.$c.$i) "set topic $w"
		pack append $w.$c $w.$c.$i {top fillx pady 2}
		incr i
	}
}
