[comp.sys.mac.programmer] moving dialog items...

gb2a+@andrew.cmu.edu (George J. Baxter) (03/20/91)

'loha...
    A question.. I've got a modeless dialog box with PICT resource items
on it acting like buttons.  I have one that I want to 'animate' in a
crude way by having it move from one position to another and back again.
 I thought I'd be tricky and get the item's Rect, HideDItem, then change
the Rect, then ShowDItem.
Guess what, it didn't work.  It wouldn't redraw the PICT, though the
Rect did in fact move.  However, upon a refresh with DialogSelect(),
kaboomy.  
    Ok, so any ideas.  I could, I suppose, use a UserItem instead of a
PICT, and 'manually' draw the PICT, but wouldn't that still cause a nice
pleasant bomb upon a DialogSelect? (or maybe not).  Anywho, any ideas
send 'em this way!
-----------------------
gb2a@andrew.cmu.edu		    baxter@a.cfr.cmu.edu

baxter@imga.cfr.cmu.edu		    q100gb2a@vb.cc.cmu.edu

"Only a Hawaiian can say Humuhumunukunukuapuaa five times fast, correctly."

hairston@henry.ECE.CMU.EDU (David Hairston) (03/20/91)

[gb2a+@andrew.cmu.edu (George J. Baxter) writes:]
[]    A question.. I've got a modeless dialog box with PICT resource items
[] on it acting like buttons.  I have one that I want to 'animate' in a
[] crude way by having it move from one position to another and back again.
[]  I thought I'd be tricky and get the item's Rect, HideDItem, then change
[] the Rect, then ShowDItem.
[] Guess what, it didn't work.  It wouldn't redraw the PICT, though the
[] Rect did in fact move.  However, upon a refresh with DialogSelect(),
[] kaboomy.  

try MoveControl(theControl: ControlHandle; h,v: Integer);

for further details: IM-I, Chap. 10, The Control Manager & Chap. 13,
The Dialog Manager (basically there's a warning about using the dialog
manager to do control manager stuff).

  -dave-  
hairston@henry.ece.cmu.edu

kurash@chocorua.dartmouth.edu (Mark Valence) (03/20/91)

In article <12425@pt.cs.cmu.edu> hairston@henry.ECE.CMU.EDU (David Hairston) writes:
>[gb2a+@andrew.cmu.edu (George J. Baxter) writes:]
>[]    A question.. I've got a modeless dialog box with PICT resource items
>[] on it acting like buttons.  I have one that I want to 'animate' in a
>[] crude way by having it move from one position to another and back again.
>[]  I thought I'd be tricky and get the item's Rect, HideDItem, then change
>[] the Rect, then ShowDItem.
>[] Guess what, it didn't work.  It wouldn't redraw the PICT, though the
>[] Rect did in fact move.  However, upon a refresh with DialogSelect(),
>[] kaboomy.  
>
>try MoveControl(theControl: ControlHandle; h,v: Integer);
>
>for further details: IM-I, Chap. 10, The Control Manager & Chap. 13,
>The Dialog Manager (basically there's a warning about using the dialog
>manager to do control manager stuff).

No, don't use MoveControl to move your PICT item.  MoveControl assumes
that the data in the handle that it is passed is a ControlRecord.
When you pass the PicHandle to MoveControl, boom-o.  Your second
intuition seemed the proper one: use a user item.  Drawing pictures
is not that difficult, and DialogSelect will not go kaboomy.  Of course,
it's not trivial:  you need a filterproc, and a user item drawing proc,
and a global variable that tells you where within the user item your
picture is located (alternately, you can use the refCon of the dialog
window to store a pointer to info about the user item, like which
PICT resource to use, where to place it, etc).  If you want details,
e-mail (although I've been having trouble with bounces lately).

>
>  -dave-  
>hairston@henry.ece.cmu.edu

Mark.