Location of a modal stack

Graham Samuel livfoss at mac.com
Fri Dec 16 04:23:57 CST 2011


Ken, it always amazes me how much you know! I have already incorporated a slightly earlier version of your solution (only difference was it didn't use a custom property) and it worked fine: the news to me was that

> modal stacks are by default set to be centered over the stack that calls it

My problem was that I have a library stack that handles all my input and output, so the 'answer file' etc dialogs, and my home-grown ones too, come from there - I never think of this stack has having a location at all, since it's just a depository for scripts - at present its location is just the one it was given by the IDE when it was created. So for me the trick is probably to make sure that the loc of this library stack (which the user never sees) is the same as the loc of the main window which my user does see (this is an app that fills the screen on the basis of 'the working screenrect'). 

If as I am fairly sure is true, the documentation doesn't mention this issue, I will suggest a note in the docs or the dictionary, if I can think of a good place to put it!

Thanks again

Graham

On Thu, 15 Dec 2011 12:11:08 -0600, Ken Ray <kray at sonsothunder.com> wrote:

> On Dec 15, 2011, at 10:49 AM, Graham Samuel wrote:
> 
>> It seems I messed up my search of this list - when I did it again, I did find some correspondence about this and a possible workaround from Ken Ray for dealing with the problem as it occurs in 'standard' dialogs, such as the 'answer' one, although I haven't followed it all up yet. 
>> 
>> OTOH that conversation makes me think much more firmly that it's a bug: why on earth shouldn't one be able to set the location of **any** stack? Why does the engine bother to fight against it? In fact, why can't we say
>> 
>> open stack "MyStack" at <location>?
> 
> You *can* set the location of any stack, but unfortunately modal stacks are by default set to be centered over the stack that calls it (why? not sure?). So to get around it, you would need to set the loc in the preOpenStack of the stack that is going to be modal. If you want to specify it from somewhere else, you could do this:
> 
> on mouseUp
>  set the uLoc of stack "MyModalStack" to 100,100
>  modal "MyModalStack"  -- or 'open stack "MyModalStack" as modal'
> end mouseUp
> 
> -- script of stack "MyModalStack"
> on preOpenStack
>  if the uLoc of this stack <> "" then
>    set the loc of this stack to (the uLoc of this stack)
>    set the uLoc of this stack to ""
>  end if
> end preOpenStack
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list