one dialog per stack or several
benr_mc at cogapp.com
Wed Jul 3 04:30:01 EDT 2002
on 2/7/02 7:00 pm, Jeanne A. E. DeVoto at jeanne at runrev.com wrote:
> You can do this either way, of course - either separate substacks, or put
> all the controls in a single stack and do a bit of fancy footwork in
> preOpenStack to hide/show/move/resize controls appropriately. But I would
> think in almost all cases the separate-stacks approach would be simpler.
The recent case I've come to is where I've got a set of related dialogs that
I want to 'think about' similarly. I made them separate cards of one stack.
There wasn't very much fancy footwork required; I made the first line of the
dialog data be the card name of the dialog actually required, and the
preOpenStack just does this:
get line 1 of the dialogData
if there is a cd it then
go to cd it
go to cd "Raw"
answer "SNH: No card " & it & "¹"
Then each card has it's own 'preOpenCard' handler to do whatever setup is
required for that dialog, based on the dialog data; each of them also call a
handler 'doResizeDialog', also defined in the stack:
set the width of this window to \
16 + (item 3 of the formattedRect of this card)
set the height of this window to \
16 + (item 4 of the formattedRect of this card)
So that was the only overhead of combining them into one stack. The payoff
is that I can share as much or as little code or controls between the
dialogs as required (and I have eight less substacks to look at in my App
But hourse for courses, of course; and in the same project I have three
other dialogs each in their own substacks.
Ben Rubinstein | Email: benr_mc at cogapp.com
Cognitive Applications Ltd | Phone: +44 (0)1273-821600
http://www.cogapp.com | Fax : +44 (0)1273-728866
More information about the Use-livecode