Window 'flashing' when changing location or size using code

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
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Window 'flashing' when changing location or size using code

Post by andyh1234 » Thu Oct 16, 2008 5:45 pm

Hi,

Ive been trying to find the answer to this everywhere!

I have a simple piece of code which stores the left, top, width and height of a stack in a text file next to a user name

When a user starts the software, then get a login screen, select a use and the software then loads the 'main' form. During the load it sets the height, width etc to the location the user previously used.

Problem is the window flickers and jumps around while the commands are being done.

Ive tried putting a lock screen message before issuing the commands, and putting them in the logon code, the preopenstack and the openstack handlers, but they are all pretty much the same.

Is there any way to stop the flickering, or perhaps to set the stack width, height and location in one step to reduce it?

Thanks

Andy

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

Post by FourthWorld » Thu Oct 16, 2008 5:53 pm

Try putting the window adjustment stuff in a preOpenStack handler rather than openStack. That way all those things are taken care of before the window is rendered to the screen.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Thu Oct 16, 2008 6:04 pm

Thanks for the suggestion.

I tried that, but what appears to happen is the window is displayed in the last position (in the compiled version thats always the position it was in on my machine), then disappears and reappears in the new position.

Its like the first command is forcing the window to draw.

Andy

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Thu Oct 16, 2008 6:09 pm

I think ive found a better command for the left and top settings..

set the topleft of stack "diary" to gProgLocation["left"], gProgLocation["top"]

In the preopenstack this is much better than setting the left and top positions separately.

Is there are similar single command to set the width and height?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Oct 16, 2008 6:12 pm

Hi Andy,

you could simply store "the rect" of your stack(s)!
Setting "the rect" of a stack will set height/width/top/left/right/bottom in ONE command!


Best

Klaus

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Thu Oct 16, 2008 6:33 pm

Thanks Klaus

That worked perfectly.

Andy

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Thu Oct 16, 2008 6:53 pm

also you can "go invisible <my stack>" and set the rect before "show stack <my stack>"

Post Reply