Page 1 of 1
Catch "Maximize/Restore" messages?
Posted: Tue Apr 22, 2008 9:24 pm
by Garrett
While working with "on resizeStack" I found out something that I didn't know before. While the message is passed when normally resizing the window itself, the message is not pass if you maximize the window. But!! when you restore, the message from the maximize is finally passed, so now your window is normal again, but the message that it was maximized is just finally passed. Which seems to muck things up a bit. Because when it restores, I get the data for when it's maximized. Here's an example of my code:
Code: Select all
on resizestack
put the left of button "ButtonExit" + 2 into varBtnsTotalWide
put varBtnsTotalWide div 3 into varBtnWidth
set the width of button "ButtonAccounts" to varBtnWidth
set the left of button "ButtonAccounts" to 0
set the width of button "ButtonServers" to varBtnWidth
set the left of button "ButtonServers" to the right of button "ButtonAccounts"
set the width of button "ButtonInstalls" to varBtnWidth
set the left of button "ButtonInstalls" to the right of button "ButtonServers"
set the left of field "Seperate1" to the right of button "ButtonInstalls"
pass resizeStack
end resizestack
Say my window was 400 wide before it was maximized. When maximized it becomes 1024 wide. The message is not passed during the maximize event. Now when I restore, it goes back to 400 wide, but then the message is passed, and it reports that the window is 1024 wide instead of the 400 wide that it is.
Is the "on resizeStack" not suppose to report a maximize event? If not, is there an event for the Maximize.. Ooo, and the restore too. Or is this a bug?
Thanks in advance,
~Garrett
Posted: Mon Apr 28, 2008 8:36 pm
by Garrett
Anybody have any info/input on this one?
Thanks,
~Garrett
Posted: Mon Apr 28, 2008 9:11 pm
by FourthWorld
I believe the resizeStack message is sent under all such circumstances, including maximize.
I wonder if something in Rev's Geometry Manager or other frontScript is interfering with the normal engine messages?
Posted: Tue Apr 29, 2008 5:30 am
by Janschenkel
The engine is sending the message as far as I can tell. I opened the Rev IDE, created a new mainstack, dragged a field onto it, and set the script of the card to:
Code: Select all
on resizeStack newwidth, newheight, oldwidth, oldheight
put newwidth, newheight, oldwidth, oldheight into field 1
end resizeStack
When I manually resized the stack, it happily updated the field; the same thing happened when I clicked the Maximize and subsequently the Restore window button, both on MacOSX and Windows.
So something must be intercepting the 'resizeStack' message somewhere along the way - the 'RevGeometry' script is loaded as backScript, so it should not be getting the message before your card or stackscript.
Maybe you could figure it out by placing a button on your stack with the following script:
Code: Select all
on mouseUp
send "resizeStack the width of this stack, the height of this stack, the width of this stack, the height of this stack" to me
end mouseUp
on resizeStack
breakpoint
pass resizeStack
end resizeStack
When you click the button, the debugger opens and you can 'Step into' the next lines of script to see where in the message path a 'resizeStack' handler is working differently than you thought.
Hope this helped,
Jan Schenkel.
Posted: Tue Apr 29, 2008 6:38 am
by Garrett
Ahhhhhhh...... I didn't realize I could obtain the new dimensions and old dimensions with that event.
I'll try that instead.
Thanks for the replies

~Garrett
Posted: Sat Jan 17, 2009 4:27 am
by keyless
There is something to this. I have a resizeStack handler that works fine if window is resized in any way, except if Windows Maximize button is used.
if the button is used, the window maximizes and I see that the resizeStack message is fired, but handler doesn't run. I have nothing else that traps the resizeStack message, but something is definitely trapping or blocking it from the handler (stack script)
Are any other message sent on Maximize that I can use?
Posted: Sat Jan 17, 2009 6:59 am
by keyless
Well I ran some tests like Jan did and now it's looking like the resizeStack handler is getting the message.
I put a break point in middle of my script in the handler and found when it stopped at the break point, the maximize of the window had not completed window had moved all the way to the left side of screen, but had not streched across to maximize yet.
Ok, so my script isn't working because I need the Maximize to work before script runs, but by going through the step through, I can see the rest of the maximize doesn't trigger until the pass resizeStack at the end of my script.
On the restore from maximize the exact opposite happens, mi script runs like the window is still maximized.
Not sure what to do? I guess some sort of send in time, but wish there was some other isolated message the maximize/restore produced, as it would solve the problem.
Posted: Sat Jan 17, 2009 11:08 pm
by keyless
figured out what to do.
I found that the maximize causes a stackMove, so I was able to make a handler for that rather than the resizeStack which i could not get to work.
Posted: Sun Jan 18, 2009 3:17 am
by mwieder
...coming late to this party, but I think what you're looking for are the iconifyStack (minimize) and unIconifyStack (maximize) messages rather than resizeStack and moveStack.
Posted: Sun Jan 18, 2009 7:28 am
by Garrett
unIconifyStack is when you restore from a minimized state. Won't help when the user maximizes the stack.
Posted: Sun Jan 18, 2009 8:53 am
by mwieder
Doh! You're right - I was thinking un-minimize.