home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
libbasic
/
dialog3.bas
< prev
next >
Wrap
BASIC Source File
|
1994-04-23
|
3KB
|
114 lines
'Dialog Box Example #3
nomainwin
dim a$(13)
dim b$(20)
dim s$(3)
s$(0) = "colors" : s$(1) = "foods" : s$(2) = "automakers"
groupbox #1, "Select items from a group", 20, 25, 265, 175
combobox #1.combo, s$(, [reloadSource], 25, 50, 120, 80
listbox #1.fromlist, a$(, [move], 50, 80, 100, 80
listbox #1.tolist, b$(, [mainLoop], 160, 80, 100, 80
button #1, " &Ok ", [exit], UL, 250, 210
button #1, ">&Move>", [move], UL, 65, 170
WindowWidth = 320
WindowHeight = 285
open "Dialog Example" for window_nf as #1
print #1.combo, "select colors"
gosub [reloadSource]
[mainLoop]
input r$ ' <-- this is the main input loop
[move]
print #1.fromlist, "selection?"
input #1.fromlist, answer$
for x = 1 to 12
if a$(x) = answer$ then a$(x) = ""
next x
print #1.fromlist, "reload"
answerCopy$ = answer$
for x = 1 to 20
if answer$ <> "" and b$(x) = "" then b$(x) = answer$ : answer$ = ""
next x
print #1.tolist, "reload"
print #1.tolist, "select "; answerCopy$
goto [mainLoop]
[exit]
close #1
end
[reloadSource]
for x = 0 to 19
b$(x) = ""
next x
print #1.combo, "selection?"
input #1.combo, newSource$
if newSource$ = "colors" then gosub [loadColors]
if newSource$ = "foods" then gosub [loadFoods]
if newSource$ = "automakers" then gosub [loadAutomakers]
print #1.fromlist, "reload"
print #1.tolist, "reload"
goto [mainLoop]
[loadColors]
a$(1) = "red" : a$(2) = "blue" : a$(3) = "green"
a$(4) = "yellow" : a$(5) = "white" : a$(6) = "orange"
a$(7) = "black" : a$(8) = "pink" : a$(9) = "amber"
a$(10) = "violet" : a$(11) = "cyan" : a$(12) = "magenta"
return
[loadFoods]
a$(1) = "eggs" : a$(2) = "milk" : a$(3) = "bread"
a$(4) = "sausage" : a$(5) = "jam" : a$(6) = "mayonaisse"
a$(7) = "spaghetti" : a$(8) = "salt" : a$(9) = "coffee"
a$(10) = "apples" : a$(11) = "cereal" : a$(12) = "pretzels"
return
[loadAutomakers]
a$(1) = "Ford" : a$(2) = "GM" : a$(3) = "Jeep"
a$(4) = "Chevy" : a$(5) = "Toyota" : a$(6) = "Dodge"
a$(7) = "Plymouth" : a$(8) = "Olds" : a$(9) = "Mercury"
a$(10) = "Volkswagen" : a$(11) = "Austin" : a$(12) = "Honda"
return
[textBox]
print #1.text, "!contents?"
input #1.text, answer$
notice answer$
goto [mainLoop]