Main Menu

Detecting (x) Close Window

Started by Cor, December 01, 2004, 06:58:35 AM

Previous topic - Next topic

Cor

GUI window
If users click the (x) Close I want to detect this before closing the program.

I cannot find it in the manual.

Is this possible?

If not then a suggestion for next version

gr.
Cor de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com

kevin

#1
Sadly,  this on the TO-DO list ATM.    I'm currently In the middle of building the retail update of 1.05, will see about slotting something in.  But it might be place holder though.    

Been meaning to add a 'style' to the open screen also, so the close button can be hidden.

Cor

Been meaning to add a 'style' to the open screen also, so the close button can be hidden.

Nice then if you left the option open of display a (x) close or not

gr.

QuoteGUI window
If users click the (x) Close I want to detect this before closing the program.

I cannot find it in the manual.

Is this possible?

If not then a suggestion for next version

gr.
Cor de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com

kevin

#3
I've added a GetScreenClose() to monitor recent close gadget events.  The events are actually monitored during the SYNC, otherwise it causes some havok with the debugger.  Will have to look at that more seriously later.    

There's a but though, in order to read the close gadget ATM, you have to disable the VM's auto break, using the BreakKey  command..  

 I'd suggest using the the compile time directives to only active this when you build an exe.  Could be annoying while your working on something.

PlayBASIC Code: [Select]
; Disable ESC & close gadget events

; >> Be careful though, make sure you can exit your program.
; As ESC or CLose gadget will no longer break the program
BreakKey Off


Repeat
Cls 0
Print "Waiting for user input"

; Checks for any recent close gadget events
If GetScreenClose()=True
; The Person hit the Close gadget
Print "Hey - Don't press that"
EndIf

; Display Screen and monitors window events
Sync
;
Until SpaceKey()=True






Cor

Thanks,

GetScreenClose()
for 1.05 retail?

cor

QuoteI've added a GetScreenClose() to monitor recent close gadget events.  The events are actually monitored during the SYNC, otherwise it causes some havok with the debugger.  Will have to look at that more seriously later.   

There's a but though, in order to read the close gadget ATM, you have to disable the VM's auto break, using the BreakKey  command.. 

  I'd suggest using the the compile time directives to only active this when you build an exe.  Could be annoying while your working on something.


; Disable ESC & close gadget events

; >> Be careful though, make sure you can exit your program.
; As ESC or CLose gadget will no longer break the program
BreakKey Off


Repeat
 Cls 0
 Print "Waiting for user input"

; Checks for any recent close gadget events
 If GetScreenClose()=True
   ; The Person hit the Close gadget
     Print "Hey - Don't press that"
 EndIf

; Display Screen and monitors window events
 Sync
;
Until SpaceKey()=True


Cor de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com

kevin

yep, it'll be in this morning build... it'll be the v1.05 release, but the compiler is build 1.06.. no big deal...