TRAPCLOSE does not work correctly in text window
Jump to navigation
Jump to search
Description
TRAPCLOSE should allow the user to confirm whether or not to close the window (for example if there is unsaved text he may be prompted to abandon it or to continue editing). LB 4.04 and 4.5.0 appear to close the text window irrespective of the user's wishes.
Example code to demonstrate the bug.
nomainwin
open "Trapclose bug" for text as #w
#w "!trapclose [ask]"
wait
[ask]
confirm "Close the window?"; answer$
if answer$ = "yes" then
close #w
end
end if
wait
Example code to work around the bug.
Use a texteditor control instead:
nomainwin
texteditor #w.te, 0, 0, WindowWidth, WindowHeight
open "Trapclose bug" for window as #w
#w "trapclose [ask]"
wait
[ask]
confirm "Close the window?"; answer$
if answer$ = "yes" then
close #w
end
end if
wait