Welcome, Guest. Please login or register.

Author Topic: Gadtools, why does thou mock me?  (Read 1213 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Steady

Re: Gadtools, why does thou mock me?
« on: February 28, 2004, 04:34:44 PM »
Hi there.

Unfortunately, you can't use GadTools scroller gadgets in window borders. The reason is given in the Rom Kernal Manual, but at least for now you can't. I remember similar problems, but used reasonably attractive Intuition ones. As you mention it doesn't give you the full look, unfotunately, but you can get most of the basic features by setting the appropriate flags.

Get the imagery for the gadgets from BOOPSI by allocating an object containing the appropriate imagery (imageclass) and then using this to draw the graphic into the button.

Example (partial extracts):
//Set up proportional gadget and arrows using standard Intuition.
/* Obtain Images for the up and down arrows (use BOOPSI sysiclass)). */
upImage = NewObject(NULL, SYSICLASS,
SYSIA_Which,    UPIMAGE,
SYSIA_DrawInfo, di,
SYSIA_Size,     SYSISIZE_MEDRES,
TAG_END);

downImage = NewObject(NULL, SYSICLASS,
SYSIA_Which,    DOWNIMAGE,
SYSIA_DrawInfo, di,
SYSIA_Size,     SYSISIZE_MEDRES,
TAG_END);
...
/* Up and down gadget definitions */
upArrow.NextGadget     = &vPropGad;
upArrow.LeftEdge       = (-sim.win[WIN_SRC]->BorderRight + 1);
upArrow.TopEdge        = (-upImage->Height - downImage->Height - sizeGHeight);
upArrow.Width          = upImage->Width;
upArrow.Height         = upImage->Height;
upArrow.Flags          = GFLG_RELBOTTOM | GFLG_RELRIGHT | GFLG_EXTENDED | GFLG_GADGIMAGE;
upArrow.Activation     = GACT_IMMEDIATE | GACT_RIGHTBORDER | GACT_RELVERIFY | GACT_BOOLEXTEND;
upArrow.GadgetType     = GTYP_BOOLGADGET;
upArrow.GadgetRender   = upImage;
upArrow.SelectRender   = NULL;
upArrow.GadgetText     = NULL;
upArrow.MutualExclude  = 0;   //Obsolete anyway.
upArrow.SpecialInfo    = NULL;
upArrow.GadgetID       = GAD_SRC_UP;
upArrow.UserData       = NULL;
upArrow.MoreFlags      = 0;
/* Bounds variables not initialised because GMORE_BOUNDS is not set */

downArrow.NextGadget     = &upArrow;
downArrow.LeftEdge       = (-sim.win[WIN_SRC]->BorderRight + 1);
downArrow.TopEdge        = (-downImage->Height -
                                  sizeGHeight);
downArrow.Width          = upImage->Width;
downArrow.Height         = upImage->Height;
downArrow.Flags          = GFLG_RELBOTTOM | GFLG_RELRIGHT |
                           GFLG_EXTENDED | GFLG_GADGIMAGE;
downArrow.Activation     = GACT_IMMEDIATE | GACT_RIGHTBORDER |GACT_RELVERIFY | GACT_BOOLEXTEND;
downArrow.GadgetType     = GTYP_BOOLGADGET;
downArrow.GadgetRender   = downImage;
downArrow.SelectRender   = NULL;
downArrow.GadgetText     = NULL;
downArrow.MutualExclude  = 0;   //Obsolete anyway.
downArrow.SpecialInfo    = NULL;
downArrow.GadgetID       = GAD_SRC_DOWN;
downArrow.UserData       = NULL;
downArrow.MoreFlags      = 0;
/* Bounds variables not initialised because GMORE_BOUNDS is not set */

(void)AddGList(sim.win[WIN_SRC], (struct Gadget *)&downArrow, 0, -1, NULL);
RefreshGadgets((struct Gadget *)&downArrow, sim.win[WIN_SRC], NULL);
------------------

Sorry for the indentation. Hope it helps a little.