Re: AW: difference between closing with the red cross or sending close?

2008-10-14 Thread Klaus Major

Hi Tiemo,



Hello again,
sometimes the basics are the hardest :) I want to be able to close  
my stack

by the standard red cross AND also by one of my self made menu items
Close.
Using on closeStackRequest traps the standard closing by the cross  
and
after answering yes the stack closes. BUT sending  
closeStackRequest from
my menu and answering yes, nothing happens. But always when  
picking a

second time the close menu and answering yes the stack closes.
Using close myStack in my menu didn't worked as expected either  
(as posted

before)
So what is the straight forward way to close from the title bar and  
a self

made menu with an answer trap?
Thank you
Tiemo


does a simple close this stack not work in your custom close  
buttons?

That should also trigger your closestackrequest handler.


Regards

Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: AW: difference between closing with the red cross or sending close?

2008-10-14 Thread Hugh Senior
Hi Tiemo,

'closeStackRequest' and 'closeStack' are messages, not commands. This means
you cannot send a 'closeStackRequest' any more than you can send a
'closeStack'. You can only 'close' a stack.

A stack will always get a 'closeStack' message, but if the user clicks the
red closebox the stack will also get a 'closeStackRequest' message first.
This means that when the user clicks the red closeBox, a closeStackRequest
message is sent followed by a closeStack message.

Lastly, you have to 'pass closeStackRequest' to continue with the close.
This is so you can optionally change your mind. This means you can stop a
closeStackRequest, but you cannot stop a closeStack.

To handle both a scripted close and a red-cross close, place your closing
routine into a shared handler and trap wheter the routine has already been
run (otherwise you will get it twice when the user clicks the red
closebox)...

on mouseUp
  close this stack
end mouseUp

local isClosing
on closeStackRequest
  answer Are you sure? with Yes or No
  if it  yes then exit closeStackRequest
  put true into isClosing
  doMyCloseStackStuff
  pass closeStackRequest
end closeStackRequest

on closeStack
  if isClosing  true then doMyCloseStackStuff
end closeStack

on doMyCloseStackStuff
  [../..]
end doMyCloseStackStuff


I have scripted the above so you can see what happens. Personally, I would
put the trap in the doMyCloseStuff handler thus...

on doMyCloseStackStuff
  if isClosing = TRUE then exit doMyCloseStuff
  else put TRUE into isClosing
  [../..]
end doMyCloseStackStuff

Hope this helps.

/H




Hello again,
sometimes the basics are the hardest :) I want to be able to close my stack
by the standard red cross AND also by one of my self made menu items
Close.
Using on closeStackRequest traps the standard closing by the cross and
after answering yes the stack closes. BUT sending closeStackRequest from
my menu and answering yes, nothing happens. But always when picking a
second time the close menu and answering yes the stack closes.
Using close myStack in my menu didn't worked as expected either (as posted
before)
So what is the straight forward way to close from the title bar and a self
made menu with an answer trap?
Thank you
Tiemo

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: AW: difference between closing with the red cross or sending close?

2008-10-14 Thread Mark Schonewille

Hi Hugh and Tiemo,

That's a nice explanation, Hugh. Usually, I do it slightly  
differently, though. I don't pass the closeStackRequest message but  
lock messages instead.


on menuPick theItem
  if theItem is Close then
answer Really? with OK or No
if it is OK then
  close this stack
end if
  end if
  -- rest of script
end menuPick

-- only triggered by close stack command
on closeStack
  doStuffBeforeClosing
end closeStack

-- click closebox
on closeStackRequest
   answer Really? with OK or No
   if it is OK then
 doStuffBeforeClosing
 lock messages
 close this stack
 unlock messages
   end if
end closeStackRequest

on doStuffBeforeClosing
  -- blabla
end doStuffBeforeClosing

This way, I don't need to keep states in boolean variables and avoid  
confusion when the cancel button is clicked.


There is nothing wrong with Hugh's approach and my aproach is hardly  
different, but I like to keep things as simple as possible. To make it  
even simpler, I could have put the doStuffBeforeClosing handler into  
the menuPick handler and get rid of the closeStack handler, but that  
would force me to add the doStuffBeforeClosing handler in all scripts  
that close the stack. Locking messages is particularly useful if  
closing the stack implies quitting the application and you want to  
call a script like the one at http://runrev.info/Save%20Way%20to%20a%20Quit.htm 
.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum/

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
 for more info.


On 14 okt 2008, at 17:32, Hugh Senior wrote:


Hi Tiemo,

'closeStackRequest' and 'closeStack' are messages, not commands.  
This means

you cannot send a 'closeStackRequest' any more than you can send a
'closeStack'. You can only 'close' a stack.

A stack will always get a 'closeStack' message, but if the user  
clicks the
red closebox the stack will also get a 'closeStackRequest' message  
first.
This means that when the user clicks the red closeBox, a  
closeStackRequest

message is sent followed by a closeStack message.

Lastly, you have to 'pass closeStackRequest' to continue with the  
close.
This is so you can optionally change your mind. This means you can  
stop a

closeStackRequest, but you cannot stop a closeStack.

To handle both a scripted close and a red-cross close, place your  
closing
routine into a shared handler and trap wheter the routine has  
already been

run (otherwise you will get it twice when the user clicks the red
closebox)...

on mouseUp
 close this stack
end mouseUp

local isClosing
on closeStackRequest
 answer Are you sure? with Yes or No
 if it  yes then exit closeStackRequest
 put true into isClosing
 doMyCloseStackStuff
 pass closeStackRequest
end closeStackRequest

on closeStack
 if isClosing  true then doMyCloseStackStuff
end closeStack

on doMyCloseStackStuff
 [../..]
end doMyCloseStackStuff


I have scripted the above so you can see what happens. Personally, I  
would

put the trap in the doMyCloseStuff handler thus...

on doMyCloseStackStuff
 if isClosing = TRUE then exit doMyCloseStuff
 else put TRUE into isClosing
 [../..]
end doMyCloseStackStuff

Hope this helps.

/H



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: AW: difference between closing with the red cross or sending close

2008-10-14 Thread Joe Lewis Wilkins

Thanks, Hugh,

Actually, Mark's version has a typo or two. (should be with No or  
Yes); was missing quotes, and seems to work differently in the IDE  
and when used with StackRunner. Don't know as a standalone, since I'm  
not going that route for the time being.


Joe Wilkins

On Oct 14, 2008, at 1:09 PM, Hugh Senior wrote:


Hi Joe,

My example was more to show how it works; Mark's is a more elegant  
version
once you know why.  My Mac is offline at the moment so I can only  
confirm

Win32, but both versions should behave the same way on both platforms.

/H





___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: AW: difference between closing with the red cross or sending close

2008-10-14 Thread Mark Schonewille

Hi Joe,

Sorry about the missing quote. I think that's the only typo. The  
script should run fine if you add that. Or did I miss something?


I don't know why it would run differently in Stackrunner. Usually, I  
make standalones.


What kind of problem do you have with closing stacks? Perhaps the  
process didn't shut down property in Windows? That's why I linked to  
the quitting script. Do you have any more problems closing stacks?


As far as I know, both approaches work fine on all platforms, but on  
Windows you need to make sure that you quit your programme properly if  
the closing stack is the only one that's open.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum/

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
 for more info.


On 14 okt 2008, at 22:18, Joe Lewis Wilkins wrote:


Thanks, Hugh,

Actually, Mark's version has a typo or two. (should be with No or  
Yes); was missing quotes, and seems to work differently in the  
IDE and when used with StackRunner. Don't know as a standalone,  
since I'm not going that route for the time being.


Joe Wilkins


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: AW: difference between closing with the red cross or sending close

2008-10-14 Thread Hugh Senior
Hi Joe,

My example was more to show how it works; Mark's is a more elegant version
once you know why.  My Mac is offline at the moment so I can only confirm
Win32, but both versions should behave the same way on both platforms.

/H


Hi fellas,

May we assume that both of these approaches work on Mac and Windows?

I have noticed some irregularities in closing that I've never
reconciled.

Thanks,

Joe Wilkins

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: AW: difference between closing with the red cross or sending close

2008-10-14 Thread Joe Lewis Wilkins

Hi Mark,

If I hadn't diddled with things some more it probably would have  
worked as you thought. I had already partially implemented a somewhat  
similar handler and in copy/pasting may have not had things strictly  
as they should be. The most confusing thing about closing/quiting in  
OSX is the elimination of the Quit item from the file menu and its  
transfer to the Application menu; plus the use of the red dot close  
button. I had been using a handler in the Stack Script to the effect:


on shutdownRequest -- confirm with the user:
   answer question Save changes before quitting? with Yes or No
   if it is No then pass shutdownRequest -- allow to quit
   else
  save this stack
  pass shutdownRequest
   end if
end shutdownRequest

plus a menuPick item :

 case Close
 answer Save changes before closing? with No or Yes
 if it is Yes then
save this stack
 end if
 close this stack
  break

This seems to work most of the time, though occasionally, I won't get  
a dialog for saving before closing. If I had more hair, I'd probably  
continue trying to figure this out. For now, I'm just saving all the  
time. But thanks...


Joe Wilkins

On Oct 14, 2008, at 1:29 PM, Mark Schonewille wrote:


Hi Joe,

Sorry about the missing quote. I think that's the only typo. The  
script should run fine if you add that. Or did I miss something?






___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: AW: difference between closing with the red cross or sending close?

2008-10-14 Thread Joe Lewis Wilkins

Hi fellas,

May we assume that both of these approaches work on Mac and Windows?

I have noticed some irregularities in closing that I've never  
reconciled.


Thanks,

Joe Wilkins

On Oct 14, 2008, at 9:02 AM, Mark Schonewille wrote:


Hi Hugh and Tiemo,






___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution