#27002 - 2002-08-13 05:02 PM
Re: Radio buttons
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Hey Brad, hows it going buddy ? You really got to visit here more often, my old friend and mentor !
Here's an idea for a UDF that me and Jan (Schuliebug) were kinda kicking around, its called OptionBox and displays a Dialog box containing option settings. You call it by passing a prompt and an array of strings representing the options, to use this in an admin script, you would first have to download and register Kixforms from here:
Kixforms
you just copy it to system32 then register it like any other ActiveX control ...
regsvr32 kixforms.dll
anways, heres the code:
code:
break on $options = "Red","Yellow","Blue","Green","Orange","Black" $prompt = "Please select a color from the list below:" $choice = optionbox($prompt,$options) ?"choice = " $choice exit 1 Function OptionBox($prompt,$options) dim $form,$label,$ok,$cancel dim $i,$top dim $radio[ubound($options)] dim $option $form = createobject("kixtart.form") $form.scalewidth = 400 $form.scaleheight = 100 $form.fontsize = 12 $form.tag = 0 $label = $form.label($prompt) $label.top = 20 $label.left = 20 $label.width = $form.scalewidth-$label.left-20 $label.height = 30 $i = 0 $top = $label.bottom + 10 for each $option in $options $radio[$i] = $form.optionbutton($option) $radio[$i].left = $label.left + 20 $radio[$i].top = $top $radio[$i].onclick = "$$option=$i" $top = $top + 30 $i=$i+1 next $ok = $form.commandbutton("OK") $ok.left = 110 $ok.top = $top+30 $ok.width = 80 $ok.height = 25 $ok.onclick = "$$form.tag=1" $cancel = $form.commandbutton("Cancel") $cancel.left = $ok.right + 20 $cancel.top = $top+30 $cancel.width = 80 $cancel.height = 25 $cancel.onclick = "$$form.tag=2" $form.height = $ok.bottom + 40 $form.center $form.show while $form.visible and $form.tag = "0" $=execute($form.doevents) loop if $form.tag = "1" $optionbox = $option else $optionbox = -1 endif $form = 0 endfunction
-Shawn
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1058 anonymous users online.
|
|
|