Custom Window: detect if user click the close button
Moderator: Neosoft Support
Custom Window: detect if user click the close button
I need to fire some actions before a user clicks the close button (the red X at the title bar) of a custom window. Just like the shutdown action. I want to pop up a message box,
asking the user if he really want´s to close the CustomWindow. If not, i want the CustomWindow to stay open.
Any Idea, or suggestion for another update?
asking the user if he really want´s to close the CustomWindow. If not, i want the CustomWindow to stay open.
Any Idea, or suggestion for another update?
Greetings from Germany
Klaus
Klaus
Re: Custom Window: detect if user click the close button
You may use the NoCloseBtn option for the customwindow and provide your own close-button where you can code what you want.
Hans-Peter
Re: Custom Window: detect if user click the close button
Klaus:
Another option would be to use the NoCloseBtn "options" parameter of the CustomWindow command.
Also, you could try using the NoBorder option ... and then simulate title bar and the X with other objects.
Not sure if you can prevent the Custom Window from closing ... but (from the Help file) ...I want to pop up a message box,
asking the user if he really want´s to close the CustomWindow. If not, i want the CustomWindow to stay open.
Would be nice if there was a way to tell NeoBook (in the :Container1_OnClose subroutine) to "Cancel/Ignore the User Request"You can define special subroutines that will be executed when a specific custom window is opened or closed. To do this, simply create two subroutines - one called ObjectName_OnOpen and one called ObjectName_OnClose. Replace ObjectName with the name of object used when opening the window. For example, the subroutines for our Container1 sample above might look like this:
:Container1_OnOpen
AlertBox "Hello" "The window is opening."
Return
:Container1_OnClose
AlertBox "Hello" "The window is closing."
Return
Another option would be to use the NoCloseBtn "options" parameter of the CustomWindow command.
Also, you could try using the NoBorder option ... and then simulate title bar and the X with other objects.
Re: Custom Window: detect if user click the close button
Thanks for your reply.HPW wrote:You may use the NoCloseBtn option for the customwindow and provide your own close-button where you can code what you want.
Yup. i have a Save & Cancel Button on stage, but for the look and feel, the customers wants a "real" windows like red 'X'
I thought about that, but the subroutine is fired AFTER the window is closed.Not sure if you can prevent the Custom Window from closing...
Not really an option, because on different systems the windows title bar looks always different.Also, you could try using the NoBorder option ... and then simulate title bar and the X with other objects.
So it seems there is no native solution.
Dave, is it possible to implement this kind of behaviour?
Greetings from Germany
Klaus
Klaus
Re: Custom Window: detect if user click the close button
This can be done by taking a snapshot of a regular windows window title bar and red 'X'. Then you can superimpose a transparent button over the x and a text box with variable for the title. If done correctly, you can't tell the difference.but for the look and feel, the customers wants a "real" windows like red 'X'
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour
Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour
Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
Re: Custom Window: detect if user click the close button
Wrangler:
Will not work if the "windows style" used by his clients is different from the "style on the Developers machine where the image was snapped"This can be done by taking a snapshot of a regular windows window title bar and red 'X'. Then you can superimpose a transparent button over the x and a text box with variable for the title. If done correctly, you can't tell the difference.
Re: Custom Window: detect if user click the close button
Well, then it's a matter of how important that is? How upset could one get that the theme doesn't match their installed theme perfectly? If you used the default windows theme, the odds are you would cover most users anyway.
I think these are the keywords here. What I propose would fullfill that request.like red 'X'
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour
Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour
Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
-
- NeoSoft Team
- Posts: 5628
- Joined: Thu Mar 31, 2005 10:48 pm
- Location: Oregon, USA
- Contact:
Re: Custom Window: detect if user click the close button
I will add this to the list of things to consider for the future.Would be nice if there was a way to tell NeoBook (in the :Container1_OnClose subroutine) to "Cancel/Ignore the User Request"
However, the way I would handle this would be to simply hide the close button like the custom window's NoCloseBtn option does. Then give the user a clear option like an OK, Accept or Done button to click when they have completed the necessary steps. The windows "X" button is supposed to mean the same as the "Cancel" button. When collecting input from the user is critical, then there should be no close or cancel options - only OK, Accept, etc.
From Microsoft's Windows Style Guide:
The Close button on the title bar should have the same effect as the Cancel or Close button within the dialog box. Never give it the same effect as OK.
NeoSoft Support
Re: Custom Window: detect if user click the close button
Dave, thank you for putting this on your to do list
Greetings from Germany
Klaus
Klaus
Re: Custom Window: detect if user click the close button
This feature is implemented in the plugin ksOnMoveSizeCustWin
Using variables [ShutdownSourceCustWin] and [ShutdownStatusCustWin], you can intercept the close button of the custom window.
Look at an example that comes with the plugin.
Using variables [ShutdownSourceCustWin] and [ShutdownStatusCustWin], you can intercept the close button of the custom window.
Look at an example that comes with the plugin.
ks
.............
.............