This should be easy
I have the following code in a button of a mainstack that calls a substack "SUB".
This is the bare bones I have removed from my application where I call a routine in a substack /library and I want the substack to align itself just at the bottom left of the field.
The aligning works perfectly if it's not a modal window , but if called with AS MODAL it centres itself within the calling stack.
I'll go out on a limb here and assume that's by design - but why? And is there any trick to getting a modal box to popup where YOU want?
Code: Select all
on mouseUp
get AdjacentTo(the long ID of me)
go to stack "sub" -- AS MODAL
end mouseUp
function AdjacentTo pField
local lcTarget, lcCallingStack
local lnRCall, lnRSub
put item 1 of the target into lcTarget
put the short name of the owner of stack "sub" into lcCallingStack
if pField is not empty then put pField into lcTarget
set the left of stack "sub" to the left of stack lcCallingStack + the left of lcTarget
set the top of stack "sub" to top of stack lcCallingStack + the bottom of lcTarget + the height of lcTarget
put the right of stack lcCallingStack into lnRCall
put the right of stack "sub" into lnRSub
if lnRSub > lnRCall then
set the left of stack "sub" to the left of stack "sub" - (lnRSub - lnRCall) - 5
end if
end AdjacentTo
