Window Positioning Bug? [WORKAROUND]

Scott Rossi scott at tactilemedia.com
Wed Jul 13 01:07:27 EDT 2005


>> When I run the following script, I actually see the offscreen-intended
>> window appear every *other* time, in other words a reliable failure that
>> occurs 50% of the time:
>> 
>> on showWindow
>>   set topLeft of stack progind to 10000,10000
>>   palette stack progind
>>   put windowID of stack progind into tID
>>   import snapshot from rect (rect of grc pie of stack progind) of window tID
>>   close stack progind
>>   choose browse tool
>> end showWindow

> couple things you should consider trying.
> 1) check the windowBoundingRect and set it larger.
> 2) set the stack's formatForPrinting property to true, this will ignore
> the windowBoundingRect; be aware of editing any text of a stack who's
> formatForPrinting prop is true.
> 3) Don't use a palette, instead copy and paste the image to your topstack
> 4) Consider using some form of:
> 
> open inv stack "progInd"
> set the topLeft of stack "progInd" to 1000,1000
> show stack "progInd"

Thanks Chipp.  However the issue I'm trying to address is to reliably place
a stack offscreen, which is used in any number of routines (not just my
import script).  In my tests, setting the position of a stack to an
offscreen location fails every other time; the stack's mode is irrelevant.
Here's an even simper script that demonstrates the problem here on OSX:

Create a new stack "WinPosTest".  Create another new main stack named
"tester", set its main stack to WinPosTest, and save.  Create a button in
stack WinPosTest and give it the following script.

on mouseUp
  set topLeft of stack "tester" to 10000,-10000
  go stack "tester"
  wait 60 with messages
  close stack "tester"
end mouseUp

On my system, this fails every *other* time in that stack "tester" appears
near the top right of the monitor when it should really appear offscreen.
This seems like a bug to me unless I'm missing something.

In any event, I finally found what appears to be a workaround.  Setting the
stack's loc repeatedly to two different positions seems to get around the
problem and reliably place the stack offscreen:

on mouseUp
  repeat 2
    set topRight of stack "tester" to -10000,10000
    set topLeft of stack "tester" to 10000,-10000
  end repeat
  go stack "tester"
  wait 60 with messages
  close stack "tester"
end mouseUp

Not sure if anyone else is affected by this issue.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list