[comp.sys.mac.hypercard] A pop-up background field ?

fk00133r@uwasa.fi (Jari Perkiomaki FKR) (03/28/90)

Hi,

I'm a novice HC programmer and faced with an irritating problem:
I would like to have a pop-up background field with text in it, to
be used anywhere in the stack. I don't want to make a pop-up card
field because the stack is open-ended with tens of different-looking
cards (only one background, however). I feel that the pop-up field
should be independent of any specific card in the stack, so it must
be in the background, right?

Now, the only solution I could find so far is the following:

on mouseUp
  put empty into text
  put "fld "&quote&"About..."&quote into text
  show text
  put "Some text, not very much..." into text
  wait until the mouseClick
  hide fld "About..."
end mouseUp

The problem is that all of the text to be shown in this field must be
written into the PUT statement in the middle of the handler. I've also
found that, in some cases, the text is not even visible in the field :-(

So any suggestions, please ?

Thanks in advance,

--Jari
-- 
Jari K Perkiomaki, OH6BG, U of Vaasa   *   School of Modern Languages
fk00133r@uwasa.fi  Site 128.214.12.3   *   PL 297, SF-65101 VAASA -- FINLAND
My opinions (c) 1990. Patent pending.

krona@nada.kth.se (Kjell Krona) (03/28/90)

> I would like to have a pop-up background field with text in it, to
> be used anywhere in the stack.

One solution I have been using is to store the text in a global
variable, and put it into the field when needed. Of course, if the
text is not removed afterwards, it will eventually be stored on all
cards. This can be easily accomplished with "opencard" and "closecard"
handlers. If we assume that the field pops up by special action, we
might write:

on openStack
        global theHiddenText
	put field "Hidden text" into theHiddenText
	-- We assume that the text is stored on a hidden field
	-- on the first card
end openStack

on popUp
	global theHiddenText
	show field "Hidden text"
	put theHidddenText into field "Hidden text"
end popUp

on closeCard
	put empty into field "Hidden text"
end closeCard

on openCard
	global theHiddenText
	if the visible of field "Hidden text" is true then
		put theHiddenText into field "Hidden Text"
	end if
end openCard

I am writing this from the heart :-), so there may be errors in
the scripts. I have used such techniques sucessfully, however.
Hopes this helps!

Kjell Krona   krona@nada.kth.se
Dept. of Architecture/Dept. of Numerical Analysis and Computer Science
Royal Institute of Technology, Stockhom, Sweden

tim@hoptoad.uucp (Tim Maroney) (03/29/90)

In article <3221@draken.nada.kth.se> krona@nada.kth.se (Kjell Krona) writes:
>> I would like to have a pop-up background field with text in it, to
>> be used anywhere in the stack.
>
>One solution I have been using is to store the text in a global
>variable, and put it into the field when needed. Of course, if the
>text is not removed afterwards, it will eventually be stored on all
>cards. This can be easily accomplished with "opencard" and "closecard"
>handlers.

Except that significant changes to a card in openStack and closeStack
handlers create a performance hit and extra disk access that is easily
perceived by the user.  It's best to minimize card changes while
opening and closing cards.  Generally, it's possible to get the changes
down to no more than hiding or showing a couple of fields or buttons,
and that seems to be the case here.  I'd bet that actually changing
a field this way on every card movement would be a real bear.

Unless it's a ton of text, it's not really going to use up that much
disk space to instantiate it on every card.  However, you should
consider that it might be better just to put this kind of thing on a
separate help card, so that there is no background field at all, just a
card field on the help card.  Judicious use of screen locking can even
make it look very much like the field *is* popping up on the current
card.

Incidentally, for pop-up fields, I generally find that the appropriate
visual effect is a dissolve.  Example:

  lock screen
  show card field "card help"
  unlock screen with dissolve fast

and vice versa for hiding it.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Superhero stories could best be described as entertainment that externalizes
 childhood power fantasies." -- Timothy Fay on rec.arts.comics