[comp.sys.mac.hypercard] How to dismiss a PICT resource shown with "picture" command?

ralph@world.std.com (Ralph Lombreglia) (04/03/91)

I'm displaying some PICT resources in xwindows using the "picture"
xcmd built into 2.0.  I want the PICTs displayed in "rect" windows
which don't have title bars and (thus no go-away boxes), and so I'm
using a mouseDownInPicture handler to dismiss the windows.  If I have
only one xwindow open, and I know the name, it's no problem:

    on mouseDownInPicture
       close window <windowname>

But if I have more than one window, and use a window's name as an
argument without also specifying the user's click location (which of
course I don't know), nothing happens:

    on mouseDownInPicture "<windowname>"
       close window <windowname>

Any suggestions on how to script this correctly?

Ralph Lombreglia
----------------
ralph@world.std.com
MCI Mail & BIX: rlombreglia

robertw@informix.com (Robert Weinberg) (04/04/91)

In article <1991Apr3.130652.12996@world.std.com> ralph@world.std.com (Ralph Lombreglia) writes:
>
>I'm displaying some PICT resources in xwindows using the "picture"
>xcmd built into 2.0.  I want the PICTs displayed in "rect" windows
>which don't have title bars and (thus no go-away boxes), and so I'm
>using a mouseDownInPicture handler to dismiss the windows.  If I have
>only one xwindow open, and I know the name, it's no problem:
>
>    on mouseDownInPicture
>       close window <windowname>
>
>But if I have more than one window, and use a window's name as an
>argument without also specifying the user's click location (which of
>course I don't know), nothing happens:
>
>    on mouseDownInPicture "<windowname>"
>       close window <windowname>
>
>Any suggestions on how to script this correctly?

You're very close, I think. Just specify a generic argument for the
mouseDownInPicture function, like this:

    on mouseDownInPicture anyWindow
       close window anyWindow
 
Don't specify an actual window name for "anyWindow".

I think that's the way it works.      


-- 
* Rob Weinberg, graphics & publishing ***** Does a falling tree make a sound *
*  {uunet,pyramid}!infmx!robertw      *****   if  1: no one hears it         * 
*  => Ask me about me.                *****   BUT 2: it is not known that    * 
*  => Ask Informix about Informix.    *****          no one hears it?        * 

ralph@world.std.com (Ralph Lombreglia) (04/04/91)

Allan Cecil at apple.com has speedily pointed out that I do not need
to know the name of open external PICT windows in order to trap for
mouse actions inside them.  My mind was on Neptune while I was
scripting (but this was the first time that's ever happened!).  The
way to make the handler generic is (obviously, and thanks again, Allan):

   on mouseDownInPicture wname --where wname is a parameter holder
      close window wname
   end mouseDownInPicture


Ralph Lombreglia
----------------
ralph@world.std.com
MCI Mail & BIX: rlombreglia