Different size cards in same stack?
Marian Petrides
mpetrides at earthlink.net
Fri Apr 23 12:18:43 EDT 2004
>> ...
>> I would like to have different size cards in the same stack. Is this
>> possible? How do I do it?
>
> You could put something like this in the cards script:
>
> on openCard
> set the height of this stack to 100
> set the width of this stack to 300
> end openCard
This works when going from one card to another in the same stack
--except that I ended up having to use preOpenCard handler to set size
of stack--probably because when I was using on OpenCard I was using the
handler to set the size of the CARD not the STACK. The key was not to
set size of card but rather to set size of stack but to do it in a
preOpenCARD (or perhaps an OpenCARD) handler. This was
counterintuitive.
However this did NOT work when I tried to use it to set the size of a
substack's window until I explicitly sent a preOpenCard message to the
new card upon leaving the original:
on mouseup
send preOpenCard to cd 1 of stack "wait while loading"
--"wait while loading" is the substack
go to cd 1 of stack "wait while loading"
end mouseup
and then
Include the following in the CARD script of card 1 of stack "wait
while loading"
on preOpenCard
set the rect of this stack to 200,200,700,400
end preOpenCard
I thought I had figured out this card vs stack and mainstack vs
substack stuff, but it looks Iike I still have some learning to do.
Thanks, Bjornke. This gave me a place to start.
M
On Apr 23, 2004, at 12:06 PM, Björnke von Gierke wrote:
To make a card a different size from the stack use PreOpenCard handler
to set the STACK's rectangle. Need to be sure to reset it on using
CloseCard handler.
on preOpenCard
global trect
put the rect of this stack into trect
set the rect of this stack to 200,200,700,400
end preOpenCard
On closeCard
send openStack to this stack
--assuming that sizing instructions are included in the openStack
handler for the stack
end closeCard
To do this by going to a separate substack (e..g. a palette substack)
1) Need to explicitly send preOpenCard to the substack as you open it
For example as part of a button script:
on mouseup
send preOpenCard to cd 1 of stack "wait while loading"
--"wait while loading" is the substack
go to cd 1 of stack "wait while loading"
end mouseup
2) Include the following in the CARD script of card 1 of stack "wait
while loading"
on preOpenCard
set the rect of this stack to 200,200,700,400
end preOpenCard
3) to exit can simply use go back as part of a mouseUp handler for
the OK button
because the main stack is still open and the card you left from is
still open in correct position and size
More information about the use-livecode
mailing list