LB Booster
General >> Suggestion Box >> trapclose error http://lbb.conforums.com/index.cgi?board=suggestions&action=display&num=1471881509 trapclose error
Post by Alincon on Aug 22nd, 2016, 3:58pm
If the destination label in a trapclose statement does not exist - perhaps a spelling error - I don't see any error message. It looks like the program is hung up, and the window will not close.
I would like to see some kind of error message, perhaps at the bottom of the screen.
r.m.
Re: trapclose error
Post by Richard Russell on Aug 22nd, 2016, 5:56pm
I would like to see some kind of error message, perhaps at the bottom of the screen.
I don't think there's any practical (and safe) way that can be achieved, sorry. Hopefully testing would quickly lead to a realisation that the trapclose isn't working.
For your interest, the difficulty arises from the fact that an event handler can be specified in so many different ways:
A 'do nothing' event: [] A branch label: [handler] A subroutine name: handler A word returned by INPUT: HelloWorld
I wonder how many people remember (or ever knew) that the fourth option exists:
Code:
button #w, "Click Me", ButtonClicked, UL, 50, 50
open "Test" for dialog as #w
#w "trapclose QuitNow"
do
input r$
print r$
loop until r$ = "QuitNow"
close #w
end
LB 4 doesn't allow the fourth kind of event handler (a word returned by INPUT) with trapclose, but LBB treats all events alike so it does.