RosettaCodeData/Task/User-input-Graphical/Liberty-BASIC/user-input-graphical.basic

49 lines
1.2 KiB
Plaintext

' [RC] User input/graphical
' Typical LB graphical input/output example.This shows how LB takes user input.
' You'd usually do more validating of input.
nomainwin ' No console window needed.
textbox#w.tb1, 100, 20, 200, 30
textbox#w.tb2, 100, 60, 200, 30
textbox#w.tb3, 100,160, 200, 30
statictext #w.st1, "String =", 10, 30, 90, 30
statictext #w.st2, "Integer =", 10, 70, 90, 30
button #w.b1, "Read and Show", [buttonClicked], LR, 180, 70
WindowWidth =360
WindowHeight =240
UpperLeftX = 40
UpperLeftY = 40
open "User input of integer & string" for window as #w
#w "trapclose [quit]" ' Clean exit routine.
#w.tb1 "!font courier 12"
#w.tb2 "!font courier 12"
#w.tb3 "!font courier 12 bold"
#w.st1 "!font courier 12"
#w.st2 "!font courier 12"
#w.tb1 "Change this string."
#w.tb2 "Enter an integer here."
#w.tb3 "Display will be here."
#w.tb1 "!selectall"
wait
[buttonClicked] ' Button-clicked routine collects data
#w.tb1 "!contents? in1$"
#w.tb2 "!contents? in2$"
#w.tb3 in1$; " "; int( val( in2$))
wait
[quit]
close #w
end