which message is sent upon a click into the closeBox?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Contact:

which message is sent upon a click into the closeBox?

Post by rozek » Fri Jun 20, 2008 10:48 am

Hello!

Sorry for bothering you, but I don't get further: which message is sent if one clicks into the CloseBox of a window's title bar?

I always thought, that would be a CloseStackRequest - but I can't see such if I observe the situation using the Message Watcher. Indeed, I can't see anything which would fit - just a bunch of mouse events, a suspendStack, and lots of cREVGeneral (as usual)

How can I trap a CloseStackRequest?

Thanks in advance for any help!
Kind regards,

Andreas Rozek

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jun 20, 2008 11:14 am

Hi Andreas,

Code: Select all

on closeStackRequest
  beep
  answer "Really?" with "Okay" or "Cancel"
  if it is "Okay" then pass closeStackRequest
end closeStackRequest
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Contact:

Post by rozek » Fri Jun 20, 2008 11:24 am

Mark,

I already have this code in my stack script - but it never get's called (perhaps I should add, I'm working with Rev 2.9.0 under WinXP)

That's the reason why I had the idea of using the Message Watcher - et voila, the message never get's SENT! (unless the Message Watcher is buggy)

I'm somewhat lost now...
Kind regards,

Andreas Rozek

rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Contact:

Post by rozek » Fri Jun 20, 2008 12:00 pm

Ok, I got it!

It's the IDE which causes the problem: the IDE's frontscript seems to catch the CloseStackRequest first. If the stack has been modified, it comes up with a dialog that let you save the stack - if you "Cancel", the message is not passed! Only if you "Save" (and, perhaps, if you "Don't save" as well) the message is passed.

This is probably a bug - I'll contact RR soon.
Kind regards,

Andreas Rozek

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jun 20, 2008 11:26 pm

Hi Andreas,

It is no bug. If you cancel the Save prompt, the stack won't close, thus your script can't run.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Contact:

Post by rozek » Sun Jun 22, 2008 7:38 am

Dear Mark,

I would like to see the "Save dialog" opened by a "BackScript" rather than a "FrontScript" as the latter makes testing my stacks much more tedious - and their behaviour always depends on wether they run within an IDE or not.

Hmmm, how do people implementing IDE plug-ins solve that problem? If a plugin opens a window which is then to be closed or hidden without triggering that (in this case) annoying "Save dialog" - how is that achieved?

Should one write a "FrontScript" in front of the IDE "FrontScript"? Which then sends the "CloseStackRequest" directly to the affected stack? And a "BackScript" which opens the "SaveDialog" itself?
Kind regards,

Andreas Rozek

Post Reply