ListBox Initial Value Setup
Dec 29, 2009 8:49:13 GMT -5
Post by sundale on Dec 29, 2009 8:49:13 GMT -5
Having difficulties in ListBox initial value setting.
I cannot get the expected results.
I have tried following code:
The result shows bellow:
Shop Code: KI
initial setup
=============
index = 5(5)
selection = 5
[OK][Cancel]
Result values
=============
index = 0
choice = KI
Why?
1) The initial value has been set properly at initial time index=5
2) But, the listbox still shows the first item
3) After "OK" is clicked the result is not correct index=0
4) But, the string value is correct.
How?
1) do I make it display fifth item "TO" at initial time?
2) if the user change the item, any method to understand that event occured?
so that I can display other items accordingly? ex) Actual Name from the code selected.
I cannot get the expected results.
I have tried following code:
' list of shop code - 12 items
shoplist$ = "CH,HH,HC,HS,TO,KI,SH,WH,CS,ET,AG,YJ"
idcount = 12
' allocate listbox array
dim shopgroup$(idcount)
for x = 1 to idcount
shopgroup$(x)=word$(shoplist,ドル x, ",")
next x
' set initial value for listbox
curID$ = "TO"
idx = 5
htmlcode = 1
print chr$(160)
if htmlcode then
html "<TABLE><TR><TD align=right>"
html "Shop Code:</TD><TD>"
else
print "Shop Code:"
end if
listbox #shopchoice, shopgroup$(), 0
if htmlcode then html "</TD></TR><TR><TD>"
print " "
#shopchoice select(idx)
print "initial setup"
print "============="
print "index = "; idx; "("; #shopchoice selection(); ")"
print "selection = "; #shopchoice selection$()
print " "
link #conf, "[OK]", [showSelected]
link #can, "[Cancel]", [cancel]
if htmlcode then html "</TD></TR></TABLE>"
wait
[showSelected]
print " "
print "Result values"
print "============="
print "index = "; #shopchoice selection()
print "choice = "; #shopchoice selection$()
[cancel]
end
The result shows bellow:
Shop Code: KI
initial setup
=============
index = 5(5)
selection = 5
[OK][Cancel]
Result values
=============
index = 0
choice = KI
Why?
1) The initial value has been set properly at initial time index=5
2) But, the listbox still shows the first item
3) After "OK" is clicked the result is not correct index=0
4) But, the string value is correct.
How?
1) do I make it display fifth item "TO" at initial time?
2) if the user change the item, any method to understand that event occured?
so that I can display other items accordingly? ex) Actual Name from the code selected.