From: hemmer@hemmer.adsp.sub.org (Franz Hemmer)
Newsgroups: comp.sys.amiga.programmer
Subject: Re: Scrollbars for windows
Date: 22 Jul 92 06:41:04 GMT
Organization: InterActivsion

In article <1992Jul20.085237.16721@syma.sussex.ac.uk> mpue2@syma.sussex.ac.uk
(James E. Talbut) writes:

>Is it possible to access the imagery that GadTools (or Workbench) uses
>for its UP/DOWN buttons?

This can be done by calling NewObject() using the 'sysiclass' (read:
System Image Class), which is a subclass to imageclass. The example
expects intuition.library to be open, and that a window has already
been opened (struct Window *TestWin) :

   /*---------------------------------------------------------------*/
   /* Getting Draw Info from Workbench screen (used by NewObject()) */
   /*---------------------------------------------------------------*/
   drinfo = GetScreenDrawInfo (TestWin->WScreen);

   /*------------------------*/
   /* Get system's UP image. */
   /*------------------------*/
   upimage = (struct Image *) NewObject (NULL, "sysiclass",
                                         SYSIA_Size,     0,
                                         SYSIA_Which,    UPIMAGE,
                                         SYSIA_DrawInfo, drinfo,
                                         TAG_END);

   /*--------------------------*/
   /* Get system's DOWN image. */
   /*--------------------------*/
   downimage = (struct Image *) NewObject (NULL, "sysiclass",
                                           SYSIA_Size,     0,
                                           SYSIA_Which,    DOWNIMAGE,
                                           SYSIA_DrawInfo, drinfo,
                                           TAG_END);

   /*-----------------------------------------------------------*/
   /* Let tmpgad point to first in list of gadgets (empty now). */
   /*-----------------------------------------------------------*/
   tmpgad = (struct Gadget *) &GList;

   /*--------------------*/
   /* Build DOWN gadget. */
   /*--------------------*/
   downarrowg = (struct Gadget *) NewObject (NULL, "buttongclass",
                                             GA_IMAGE,     downimage,
                                             GA_TOP,       44,
                                             GA_LEFT,      180,
                                             GA_ID,        GD_DOWN,
                                             GA_PREVIOUS,  tmpgad,
                                             GA_IMMEDIATE, TRUE,
                                             GA_RELVERIFY, TRUE,
                                             TAG_END);

   /*------------------*/
   /* Build UP gadget. */
   /*------------------*/
   downarrowg = (struct Gadget *)
                NewObject (NULL, "buttongclass",
                           GA_IMAGE,     upimage,
                           GA_TOP,       44,
                           GA_LEFT,      180 + (downarrowg ?
                                                downarrowg->Width : 0),
                           GA_ID,        GD_UP,
                           GA_PREVIOUS,  tmpgad,
                           GA_IMMEDIATE, TRUE,
                           GA_RELVERIFY, TRUE,
                           TAG_END);

   /*------------------------------------------------*/
   /* Adding the gadgets to our windows gadget list. */
   /*------------------------------------------------*/
   AddGList (TestWin, GList, -1, -1, NULL);
   RefreshGList (GList, TestWin, NULL, -1);

>Thanks for any help.

Welcome... "Isn't Boopsi wonderful ?!!"

--
*-------------------------------------------------------------------------*
|         _   UseNet: (uunet|rutgers|pyramid)!cbmvax!cbmehq!cbmden!hemmer |
|         \\ _                         CBMNET: hemmer@hemmer.adsp.sub.org |
| InterActi\X/ision - The name of precision                               |
| Best regards                         >> Carpe Diem! - Seize the day! << |
| Franz Hemmer - Software Developer.                                      |
*-------------------------------------------------------------------------*