Minimise with windowshape -- SOLUTION

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
AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Minimise with windowshape -- SOLUTION

Post by AndyP » Wed Jun 09, 2010 1:10 pm

There is a well known and long standing bug when minimising when a custom window shape is used.
Basically it does not work!
There is no problem if standard window decorations are used.

Searching the forum the accepted solution is as below:

In the mimimize button script:
on mouseup
set the windowshape of this stack to 0
set the iconic of this stack to true
end mouseup


In the stack script:
on unIconifyStack
set windowShape of me to <your background image id>
end unIconifyStack

However this also does not work correctly and on Win 7 will not show a preview in the taskbar popup.

:idea: WORKING SOLUTION tested on XP and Win7
A bit of lateral thinking.... As minimise works on a standard window, why not just set the minimise decoration prior to minimise?
So the script above becomes:

In the mimimize button script:

on mouseUp
--reset the windowshape to default and add a minimise button, required due to iconic command bug
set the decorations of this stack to "minimize"
set the iconic of this stack to true
end mouseUp

In the stack script:

In the stack script:
on unIconifyStack
-- revert to original window shape, doing so automatically removes the minimise decoration
set windowShape of me to <your background image id>
end unIconifyStack

Hope this helps.
Andy .... LC CLASSIC ROCKS!

kotikoti
Posts: 72
Joined: Tue Apr 15, 2008 7:35 pm

Re: Minimise with windowshape -- SOLUTION

Post by kotikoti » Wed Jun 09, 2010 7:43 pm

Thanks Andy
Build 160
Version 2.9.0
Platform: Windows

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Minimise with windowshape -- SOLUTION

Post by FourthWorld » Thu Jun 10, 2010 6:05 pm

Good tip, Andy. Thanks.

And I love your sigline. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

nlexa
Posts: 26
Joined: Fri Aug 05, 2011 2:34 am

Re: Minimise with windowshape -- SOLUTION

Post by nlexa » Fri Aug 19, 2011 3:22 am

I've tried all the various approaches above and have found my own solution - shorter and perhaps more elegant.

Code: Select all

on preOpenStack
set the windowShape of this stack to 1195 --must be first or the minimise wont work
set the decorations of this stack to "title" 
end preOpenStack
if you add
show this stack
hide this stack
to either side of setting the window shape and decoration and inside the preopenstack it stops the flicker (not that its much of a concern)
there is some kind of conflict between setting the decoration and setting the shape. You have to set them together in that order for it to work.

I'm using 4.6.3 and xp

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Minimise with windowshape -- SOLUTION

Post by AndyP » Fri Aug 19, 2011 8:47 am

Hi nlexa ,

Just tried this out on Win7...works great.

Nice solution. i will be substituting my code in PointandSee for yours, much more elegant!
Andy .... LC CLASSIC ROCKS!

Post Reply