|
Post by peggion on Mar 12, 2019 9:54:26 GMT -5
Hi, I used the command TrapClose in LB version 4.03 and 4.5 but it doesn't seem to work on realese 5 - alpha:
graphicbox #boleto.gbx, 30, 30, 900, 480 .....
#boleto,gbx, "Trapclose [Fim]" .... wait
[Fim] close #boleto end
Fim is End in portuguese.
thanks Andre
|
|
|
Post by Chris Iverson on Mar 12, 2019 9:59:33 GMT -5
1) Your code will not work as written in LB4 due to the comma in the handle specifier for the trapclose command(you need #boleto.gbx, not #boleto,gbx)
2) Even if you correct that, your code will not work properly. The window will appear to close, but it won't actually close and end the program. It will still be running in the background.
This is because you do not issue TRAPCLOSE on child windows. You issue it on top-level windows. In this case, you wouldn't call trapclose on the gbx control.
#boleto "Trapclose [Fim]"
That's what you need. The window(#boleto), not the control(.gbx)
There IS a difference in LB5 here, in that you can't issue any generic control a TRAPCLOSE command. You WILL get an error message. This is a good thing; instead of hiding the error, and hiding the fact that the window close event isn't going to be handled properly, it immediately pops up an error stating as much, so you can fix it.
3) Having the comma after the handle specifier doesn't seem to work in LB5 at the moment. (if you use the full syntax of the command, 'PRINT #handle, "command"', it works, and in fact, you NEED the comma, or it won't send the command to the handle. if you omit the PRINT statement, '#handle, "command"' doesn't seem to work, at least for trapclose. It needs to be '#handle "command"'.)
|
|