Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Gadtools, why does thou mock me?
« on: February 28, 2004, 08:15:19 AM »
Can anyone tell me if gadtools scroller gadgets can/should be used in window borders?  Apparently gadtools gadgets are not to have relative sizes or positions which would make resizing a window with horizontal and vertical scrollers more difficult than would seem to be necessary.  

Still, I might come up with some other use for these gadgets but I've had no luck finding which is the propgadgetnewlook flag so the scroller I've managed to create in my small test program looks very old fashioned - why the hell does gadtools bother with a render style of a version of workbench it won't run on?  

Finally, if I'm stuck with intuition for the gadgets I want in my window, where does the imagery for the little arrow gadgets that most windows/programs use in conjunction with their proportional gadgets come from?  
H2O2
 

Offline Steady

Re: Gadtools, why does thou mock me?
« Reply #1 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.
 

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Re: Gadtools, why does thou mock me?
« Reply #2 on: February 28, 2004, 09:26:33 PM »
Hello Steady.  Thanks for an informative reply - I'd noticed that most programs I load into my debugger use BOOPSI to create their interfaces but I've been reluctant to do the same.  

Looks like I've got even more RKM reading ahead of me - I'll be sleeping well this week!  Would that be called RKM sleep?  

;)
H2O2
 

  • Guest
Re: Gadtools, why does thou mock me?
« Reply #3 on: February 28, 2004, 10:28:06 PM »
Gadtools mocks you because it's a deprecated interface :D

Try just using BOOPSI gadgets (much easier to use, too).

On the other hand.. you could look at MUI. It's calling
you.. calling you.. tempting..

=Neko=
 

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Re: Gadtools, why does thou mock me?
« Reply #4 on: February 29, 2004, 09:26:01 AM »
Ha!  I like the fact there are popular interface alternatives for Amigans who want them but I like simple applications that run on any old amiga more.  

Unfortunately modern programming concepts like BOOPSI are still utterly mystifying to me and seemingly innocent little programs that I use all the time turn out to do odd things like creating and switching to new processes for themselves before I can find out how they create their interfaces whilst 'debugging' them.  

Is it just me or is there a distinct lack of assembler source examples for wb2+ interface programmng?  
H2O2
 

  • Guest
Re: Gadtools, why does thou mock me?
« Reply #5 on: February 29, 2004, 12:45:19 PM »
Lack of assembler: yep. Nobody uses assembler anymore.

Running your assembler Gadtools stuff on any OLD Amiga
is fine enough. Can you justify a hand-crafted assembler
with an OS1.3 GUI under MorphOS or AmigaOS 4, even if it
runs on an Amiga 500 too?
 

Offline x303

Re: Gadtools, why does thou mock me?
« Reply #6 on: March 02, 2004, 07:17:29 PM »
Why not use GTlayout or Reaction ???

[color=FF0000]x303[/color] :-D  :-D  :-D