[comp.sys.mac.programmer] Correct way in Dialog to set Icons on the fly

wolf@piquet.cipl.uiowa.edu (Michael J. Wolf) (06/28/91)

What is the proper way to set and change ICON dilaog items?

I would like to use the same dialog template but set the ICONs as
I go (ie, just before or while the dialog is visible).

Should I get the ItemHandle, and go to the correct offset (something
like 10 bytes from where the handle points) and manual modify this 
integer to the ID of the ICON I want to be displayed now.  Afterward
do a draw dialog?

Is this acceptable and does this work?

Thanks

Michael

peirce@outpost.UUCP (Michael Peirce) (06/29/91)

In article <6706@ns-mx.uiowa.edu>, wolf@piquet.cipl.uiowa.edu (Michael J. Wolf) writes:
> What is the proper way to set and change ICON dilaog items?
> 
> I would like to use the same dialog template but set the ICONs as
> I go (ie, just before or while the dialog is visible).
> 
> Should I get the ItemHandle, and go to the correct offset (something
> like 10 bytes from where the handle points) and manual modify this 
> integer to the ID of the ICON I want to be displayed now.  Afterward
> do a draw dialog?

I'm not sure about icons (i tried it), but I know you can
set the item handle for a PICT item to a Picture Handle and 
have the the new picture drawn.

You might try this with a handle to an icon too.

Here's how it's done with PICTs:

   GetDitem(theDialog,kPict2Item,itemType,pictH,itemRect);
   pictH := aPictHandle;
   SetDItem(theDialog,kPict2Item,itemType,pictH,itemRect);


Or if it doesn't work with icons, use PICTs instead...

-- michael

--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE

peirce@outpost.UUCP (Michael Peirce) (06/29/91)

In article <D2150035.jcvzon@outpost.UUCP>, peirce@outpost.UUCP (Michael Peirce) writes:
> 
> In article <6706@ns-mx.uiowa.edu>, wolf@piquet.cipl.uiowa.edu (Michael J. Wolf) writes:
> > What is the proper way to set and change ICON dilaog items?
> > 
> > I would like to use the same dialog template but set the ICONs as
> > I go (ie, just before or while the dialog is visible).
> > 
> > Should I get the ItemHandle, and go to the correct offset (something
> > like 10 bytes from where the handle points) and manual modify this 
> > integer to the ID of the ICON I want to be displayed now.  Afterward
> > do a draw dialog?
> 
> I'm not sure about icons (i tried it), but I know you can
                             ^
                             |
                          haven't


Sorry :-(

--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE