[comp.sys.mac.hypercard] How do you manage hidden

gft_robert@gsbacd.uchicago.edu (opcode ranger) (04/25/91)

How does one manage hidden windows (stacks)?  I'm having serious difficulties.
I use a second stack to store info about certain changes in my first.  In
HyperCard 1.0 I simply opened stack 2 wrote the info, and then went back to
stack 1. I can do this in 2.0, but it's SLOW.  I'd like to have the 2nd stack
already open (in memory).  OK, I thought about opening the 2nd stack from
within the openStack handler in the first stack and keeping stack 2's window
hidden, and then closing in my stack 1 closeStack handler.  But it was not to
be.

I finally did get the openstack part to work correctly (stack 2 is here called
"inout history").  Here from the script of the first stack:
----------------------------
on openstack
  push cd
  lock screen
  go to "inout history" in a new window
  if there is a window "inout history" then hide window "inout history"
  pop cd
end openstack
----------------------------

This works fine.  Interestingly, the push and pop cd statements are necessary.
Otherwise, when you hide the stack "inout history", stack "inout history"
remains the frontmost window, even though it's hidden.  I thought that when you
hid one stack window, the other is supposed to come to the front (activate). 
Nope. In this case, the 1st stack (let's call it "tracker")  remains
deactivated.  If you pull down the menu "about stack" it will show you the
current stack is "inout history".  If you dismiss this dialog, "tracker"
activates.  Is this a bug?

As I said, I finally got that to work with the push/pop cd pair.  I can't
figure out how to get rid of my hidden window, though.  If I try this in the
"tracker" stack:

----------------------------
on closestack
	if there is a window "inout history" then close window "inout history"
end closestack
----------------------------

it won't close window "inout history" ("Can't close that window." is the
result). It remains hidden, and the window "tracker" goes away (I've only done
this with 3 or more total windows, so whatever's the 3rd window hanging around
appears).

So I tried this in the script of stack "tracker":
----------------------------
on closestack
  if there is a window "inout history" then
    push cd
    go to "inout history"
    close window "inout history"
    pop cd
  end if
end closestack
----------------------------

the window of "tracker" disappears and the window for "inout history" appears,
but *WITH THE TITLE "TRACKER" IN THE WINDOW'S TITLE BAR*!  Weird!!  (Bug??)

How would one manage this? (And are these bugs, or just weird errors on my
part?).  Also: is there any good  HyperCard 2.0 documentation you can
recommend.  The script language guide is just not complete (for instance, what
can you do during a closestack handler? Anything you want? And what
circumstances cause you to get a "Can't close that window" result when you try
to close a window that exists?)

Any help much appreciated!  (sorry for the jumbled nature of this note).


Robert


-- 
============================================================================
= gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to =
=            		         * all my opinions are *  compute"         =
=                                * mine                *  -Kraftwerk       =
============================================================================

fwb@pollux.tmc.edu (Fred Brehm) (04/25/91)

In article <1991Apr24.162809.1@gsbacd.uchicago.edu> gft_robert@gsbacd.uchicago.edu (opcode ranger) writes:
>...
>So I tried this in the script of stack "tracker":
>----------------------------
>on closestack
>  if there is a window "inout history" then
>    push cd
>    go to "inout history"
>    close window "inout history"
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    pop cd
>  end if
>end closestack
>----------------------------
>... confusing behavior

Try _doMenu "Close Stack"_ in the line I marked above. Remember, this window
is a stack!

I agree that close window should work because it feels like it should be a
valid operation on any window object. HC doesn't seem to handle inheretence
that way, though.

Fred
-- 
Frederic W. Brehm	Siemens Corporate Research	Princeton, NJ
fwb@demon.siemens.com	-or-	...!princeton!siemens!demon!fwb

man@cs.brown.edu (Mark H. Nodine) (04/26/91)

In article <59276@siemens.siemens.com>, fwb@pollux.tmc.edu (Fred Brehm) writes:
|> In article <1991Apr24.162809.1@gsbacd.uchicago.edu> gft_robert@gsbacd.uchicago.edu (opcode ranger) writes:
|> >...
|> >So I tried this in the script of stack "tracker":
|> >----------------------------
|> >on closestack
|> >  if there is a window "inout history" then
|> >    push cd
|> >    go to "inout history"
|> >    close window "inout history"
|>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|> >    pop cd
|> >  end if
|> >end closestack
|> >----------------------------
|> >... confusing behavior
|> 
|> Try _doMenu "Close Stack"_ in the line I marked above. Remember, this window
|> is a stack!
|> 
|> I agree that close window should work because it feels like it should be a
|> valid operation on any window object. HC doesn't seem to handle inheretence
|> that way, though.

Actually, I believe that HC will not allow you to close the last window, and I
think that's the problem you're running into.  You could try leaving the
"inout history" window, but when you get there do a "go home" command.

Also a tip: before you go to the other stack to save some stuff by doing
   go to "inout history"
do a
   set the lockmessages to true
This will speed up the execution more than keeping the other stack in memory,
because it will not execute all the OpenStack, OpenBackground, etc. handlers
in the new stack.  That's not a problem since you're not actually landing there.

	--Mark