I get some falts when the red cros is used, and want to override some code if the red cross is used for closing the window
Best regards
Edvard Korsbæk
I get some falts when the red cros is used, and want to override some code if the red cross is used for closing the window
Best regards
Edvard Korsbæk
You can use a local variable to either check whether the window has been closed the “correct” way or to make it so the user cannot use the X or escape and must close it the way you intend.
Attached example shows using such a variable.
CannotClose.zip (6.8 KB)
Hi Edvard.
I assume you are talking about closing a window by pressing the red cross at the top right? From what I remember, this used to be a problem with Windows XP and Clarion 5 or Clarion 6 (can’t remember which). Some more information might help. What is your Windows and Clarion version?
Thys
You want the Red X to go through your Cancel button?
All closing goes through EVENT:CloseWindow (unless it does an Accept BREAK or DO ProcedureReturn). That includes OK, Cancel, Red X and other ways to close: Escape, Ctrl+F4, System Menu, Frame Close Down.
One way to do this is to have a local variable AllowClose BOOL.
In Event:CloseWindow check if AllowClose =False then Post(EVENT:Accepted,?Cancel) and CYCLE, so you effectively click Cancel.
In Cancel and Event:Competed (OK done) set AllowClose = TRUE to allow Window to close. So any other method Allow=False and it pushes Cancel.
I think there was an article in ClarionMag by Tom Habenstreit
Just disable red cross.
That leaves other ways to close: Escape, Ctrl+F4, System Menu, Frame Close Down
If I’m correct, Edvard has no issues with other ways to close.
My problem is, that if i close the main frame window with the red cross, and there is still some MDI windows open, there happens unfortunate things in them. So i need to set a global variable glo:red_cross_Used to handle the closing of some MDI windows correctly.
When I am thinking over it, I really don’t know how the MDI windows finds out, that the main window is closed - And that knowledge could give me the clue to handle the MDI windows.
See Event:CloseDown in the help.
and also might help CleanCloseDown
Thanks!
Gives me a way.
Best regards
Edvard Korsbæk