|
| preventing to close window |
| Iniciado por patrick, 27,jun. 2006 11:36 - 5 respuestas |
| |
| | | |
|
| |
| Publicado el 27,junio 2006 - 11:36 |
hello everyone, is there a way to prevent a user from closing a window by clickin on the X-button in the upper-right corner of the window ? I can detect when a user does this, but then the window allready closes. The minimise and maximise button need to be available for the user, only the Close button needs to be disabled greetz, Patrick |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,junio 2006 - 12:07 |
Hi Patrick, Assign the shortcut ALT+F4 to a button and catch the close button (X) click there. Ciao, P.
hello everyone, is there a way to prevent a user from closing a window by clickin on the X-button in the upper-right corner of the window ? I can detect when a user does this, but then the window allready closes. The minimise and maximise button need to be available for the user, only the Close button needs to be disabled greetz, Patrick |
| |
| |
| | | |
|
| | |
| |
| Publicado el 17,octubre 2006 - 15:11 |
Hello Patrick,
Greetings !
Declare an event in a window's initialization event as:
Event("CloseMainWindow", "WindowTips", 16) // 16 = WM_CLOSE event
In CloseMainWindow procedure check the event as follows:
IF gbCanClose = True THEN // gbCanClose is a global variable EndProgram() ELSE Info("Clickez sur Exit menu/Button, s'il vous plait.") RESULT False END
Hope it helps you. Regards
Rajan Dahal ICT Workers P.O. Box 5207 Kathmandu NEPAL susankhya2003@yahoo.com |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,agosto 2013 - 05:06 |
The event approach will also catch the Escape key closing the window but the Alt-F4 approach will not.
I realize that was not the original question, but it was my question when I found this.
To keep the ESC key from killing your window in the event procedure:
IF KeyPressed(kpEscape) THEN RESULT False END |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,agosto 2013 - 22:48 |
HI Bob
or just set the ALT-F4 button type as "cancel', and the ESC will be trapped too
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
More information on http://www.fabriceharari.com
On 7/31/2013 9:06 PM, Bob Roos wrote:
The event approach will also catch the Escape key closing the window but the Alt-F4 approach will not. I realize that was not the original question, but it was my question when I found this. To keep the ESC key from killing your window in the event procedure:
IF KeyPressed(kpEscape) THEN RESULT False END |
| |
| |
| | | |
|
| | |
| |
| Publicado el 05,abril 2020 - 16:46 |
Let's say you want to disable Alt+F4 for all the windows in your project with a Windows Template screen :
1) Put the following code into your projects initialization code
EXTERN "KeyConst.WL" EXTERN "WinConst.WL"
2) Open your Windows template screen 3) add a button to the Windows template screen (place it to the right of the right outside screen border and set the "anchor" of the button to "Right" so it will never appear on the end user's screen) 4) In the "Button Description -> GUI" : Set "Shortcut" to "Alt+F4" 5) In the "Button Description -> GUI" : Uncheck "Accessible by TAB" under the "Parameters" title (so that the end-user can't select the button bt Tab that's on the outside of the screen)

6) Put the following code behind the button click event
IF KeyPressed(kpAlt) AND KeyPressed(VK_F4) THEN Info("Alt+F4 is disabled") ELSE Close() END
And you're done! |
| |
| |
| | | |
|
| | | | |
| | |
|