A pushbutton id is not a number?

Why does this code yield compile error messages saying the pb- caaes require a number?

program tsatest

LIBRARY "c:\program files (x86)\tbsilver\tblibs\truectrl.trc"
call TC_INIT

call setwins
call buttons
window #96
call display

sub setwins

call TC_WIN_CREATE(btns,"title",.20, .50,.18, .313)
call TC_SHOW(btns)
call TC_WIN_SETFONT(btns,"Helvetica",10,"BOLD")
call TC_WIN_SETTITLE(btns,"Scroll/Edit/Search Control Window (no click = continue)")
open #95: screen 0, 1, 0, 1

end sub

sub buttons
call TC_WIN_ACTIVE(btns)
window #95
call TC_PushBtn_Create(pb1, "Main Menu", .01, .31, .76, .99)
call TC_PushBtn_Create(pb2,"Record Number", .01, .31, .51, .74)
call TC_PushBtn_Create(pb3, "Tsalagi Order", .01, .31, .26, .49)
call TC_PushBtn_Create(pb4, "English Order", .01, .31, .01, .24)
call TC_PushBtn_Create(pb5, "Continue As Is", .38, .68, .76, .99)
call TC_PushBtn_Create(pb6,"Edit Top Record", .38, .68, .51, .74)
call TC_PushBtn_Create(pb7, "Search English", .75, 1, .76, .99)
call TC_PushBtn_Create(pb8, "Search Tsalagi", .75, 1, .51, .74)
call TC_PushBtn_Create(pb9, "Down One Record", .75, 1, .26, .49)
call TC_PushBtn_Create(pb10, "Up One Record", .75, 1, .01, .24)
call TC_PushBtn_Create(pb11, "Add Record", .38, .68, .26, .49)
end sub

sub display
call TC_WIN_TARGET(btns)
window #95

do while q$ = "?"
call TC_EVENT(0, event$, wn, x1, id)
window #96
if event$ <> "control deselected" then
exit select
else
call TC_RadioGroup_On(rid,xd)
select case xd
case pb1
input prompt "select pb1": f$
case pb2
input prompt "select pb2":f$
case pb3
input prompt "select pb3":f$
case pb4
input prompt "select pb4":f$
case else
input prompt "select ELSE$":f$
end select
end if
let q$ = "X"
loop
end sub

call TC_cleanup

end

Thanks? (lol)

Comments

SELECT CASE

Hi,

SELECT CASE requires that the individual CASES are defined by numeric or string CONSTANTS e.g. CASE 1, CASE 2, CASE 3 etc. You cannot use variables.

However, you could re-write your code using multiple IF ...THEN...ELSE clauses, because IF...THEN allows you to use variables.

You have used WINDOW #95 several times in your code. You do not need WINDOW statements when you use TrueCtrl because TrueCtrl automatically creates a logical window for every Physical window.

Regards
Big John