Location of a modal stack

Ken Ray kray at sonsothunder.com
Thu Dec 15 13:11:08 EST 2011


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