Post by sundale on Jan 24, 2010 15:30:08 GMT -5
To choose an item from a list box is easy.
But, if the list is read from the database, over hundreds of items are listed,
then the listbox is not a good choice.
So, instead, I tried to list them and select.
The idea is successful, but I am facing strange behaviour:
To clear the listed items after selection, I used sub-applicaton.
Using RUN command, I have created sample as bellow.
The behaviour:
1. At first call, it displays correctly.
2. On second call, it duplicate the list
3. On third call, it beocme three times of the list.
4. And continue, even though I clear the screen from the runed program.
Question:
1. Am I done something wrong?
2. How to clear the sub-program's screen
3. A better method of list and selection?
4. Can I kill the RUNned program?
The main routine
The sub-routine
But, if the list is read from the database, over hundreds of items are listed,
then the listbox is not a good choice.
So, instead, I tried to list them and select.
The idea is successful, but I am facing strange behaviour:
To clear the listed items after selection, I used sub-applicaton.
Using RUN command, I have created sample as bellow.
The behaviour:
1. At first call, it displays correctly.
2. On second call, it duplicate the list
3. On third call, it beocme three times of the list.
4. And continue, even though I clear the screen from the runed program.
Question:
1. Am I done something wrong?
2. How to clear the sub-program's screen
3. A better method of list and selection?
4. Can I kill the RUNned program?
The main routine
run "testrunsub", #sr
html "
<TABLE border-style:solid; bordercolorlight='#000000' bgcolor='#C0C0C0' cellspacing='1' cellpadding='6'><TR>
<TD style='background-color: #008000' align='right'><font color='#FFFFFF'>"
html "Ship Information</font></TD>"
html "</TD><TD><b>Owner:"
textbox #owner, owner$, 20
imagebutton #selowner, "/green_down.gif", [selectOwner]
html "</TD><TD><b>Captain:</b>"
textbox #captain, captain$, 5
imagebutton #selcaptain, "/green_down.gif", [selectCaptain]
html "</TD><TD>"
button #accept, "Accept", [acceptAll]
html "</TD></TR></TABLE>"
wait
[selectOwner]
kf$ = "#owner"
goto [callnow]
[selectCaptain]
kf$ = "#captain"
[callnow]
render #sr
k = #sr readit(kf$)
wait
[acceptAll]
print "Owner = ";#owner contents$()
print "Captain = ";#captain contents$()
end
The sub-routine
global fname$
wait
[setUnique]
cls
html "<script> document.getElementById('"; fname$; "').value = '"; EventKey$; "';</script>"
wait
function readit(f$)
fname$ = f$
own$ = "Rose,Garden"
cap$ = "Cook,Halock,Underpants"
if f$="#owner" then d$=own$ else d$=cap$
cls
e$ = word$(d$,1,",")
i = 1
while e$<>""
link #getu, e$, [setUnique]
html " "
#getu setkey(e$)
i = i + 1
e$ = word$(d$,i,",")
wend
end function