Glenn BarnasAdministrator
(KiX Supporter)
2003-03-03 08:14 PM
KixForms Quickie?

I am trying to populate a combobox with a list of values from an array of 7 elements. I want to default the selection to one of the elements based on what another variable contains.

The "match" variable will contain exactly the same text as one of the combo-box elements. I assume that I need to use the "$cboChoice.Selected" property, but I'm not sure how to specify WHICH element in the combo box to apply it to. The online help is not available for that topic, and I can't find an example in the sample scripts (yet).

Here's what I've got so far - don't know how to make the item Selected when I find it.
code:
 
$Default = "Green" ; set elsewhere...

$aryTYPES = "Red", "Green", "Blue"
For Each $Tmp in $aryTYPES
$cboType.AddItem($Tmp)
If $Tmp = $Default
; mark this item SELECTED

; HOW???

EndIf
Next

Thanks!

Glenn

PS - is any other KixForms documentation available that I'm not looking at??


JochenAdministrator
(KiX Supporter)
2003-03-03 08:18 PM
Re: KixForms Quickie?

Here u are :



$Default = 1 ; set elsewhere... but set the Array Element Number !!!

$aryTYPES = "Red""Green""Blue"

;create the Combo before  [Wink]
$cboType.List = $aryTYPES ; populate Combo
$cboType.ListIndex = $Default ;sets marked item to $Default



hth
Jochen

[ 03. March 2003, 20:19: Message edited by: jpols ]


ShawnAdministrator
(KiX Supporter)
2003-03-03 08:19 PM
Re: KixForms Quickie?

Hi Glenn,

Heres a shortcut for doing both those thingies:

code:
$cboType.List = "Red", "Green", "Blue"

$cboType.Text = "Green"

-Shawn


JochenAdministrator
(KiX Supporter)
2003-03-03 08:20 PM
Re: KixForms Quickie?

wahey Shawn ... Youre online ?

{Hijacking Post}


Glenn BarnasAdministrator
(KiX Supporter)
2003-03-03 08:59 PM
Re: KixForms Quickie?

Thanks, guys..

Where, if not on the KixForms site, would you get this info? Is it close enough to use VB docs? (not that I'm too good at VB, but they're available)

Gonna go with Shawn's suggestion, as I'd have to write additional code to determine the index of the default. The value is queried from a remote system, but I didn't want to make the sample that complex. But - I now have two ways documented to set the cbo default. [Big Grin]

Shawn: - Just gotta ask.. (since your code post wasn't in color) Did the use of the kix code formatter relate in any way to your previous Avatar (or vice-versa)? [Wink]

Glenn


Sealeopard
(KiX Master)
2003-03-03 09:10 PM
Re: KixForms Quickie?

Use ASCAN or the IsInArray() UDF to find the index of an element in an array.

ShawnAdministrator
(KiX Supporter)
2003-03-03 09:38 PM
Re: KixForms Quickie?

Glenn - avitar & color ?

Yeah actually, it did relate to postprep a little bit I guess - I asked Jose if he could add a splash of color and this was while Jochen and Jooel were developing PostPrep - I don't have PostPrep handy where I am right now, thats why I didn't use it.

Ahoy Captain - I'm never too far away from the family here at korg !

-Shawn

ps

Docs ? I'm working on the CHM as we speak. Also trying to get the next version of kixforms out the door.

[ 03. March 2003, 21:40: Message edited by: Shawn ]


Jose
(Seasoned Scripter)
2003-03-03 10:18 PM
Re: KixForms Quickie?

Shawn You got your hat back again !! [Wink] .
I can see the pills finally made effect your color came back too.
Pass me the rehab clinic phone number I might need it........soon. [Cool]

If any makeup change is required please let me know. IŽll be glad. Thanks.

[ 03. March 2003, 22:55: Message edited by: jose3 ]