[comp.sys.amiga.tech] AddGadget

goldberg@rodan.acs.syr.edu (Ross Goldberg) (12/15/90)

I can not figure out how those 3 above commands work.  I need to be able
to add and remove gadgets so I can position them where defined by the
user.  

With the 1 gadget defined, I tried to 
RemoveGadget(my_gadget)
(system hung)
RemoveGadget(&my_gadget)
(system request window began to appear and it hung)

I assume it must be attached to the window (my_new_window) but can't figure
out how and these commands are not documented anywhere that I can find.

I am using CManual Gadgets Example7.c as the foundation for experimentation
if you are wondering exactly what the code looks like.

thanx,
Ross

bleys@tronsbox.xei.com (Bill Cavanaugh) (12/15/90)

From the old Intuition Reference Manual (1986), and probably in the Includes
and Autodocs (I don't have my copy handy)...

begin-quote

AddGadget(AddPtr,Gadget,Position)

This function adds a gadget to the gadget list of a window.
     AddPtr is a pointer to the window
     Gadget is a pointer to the gadget.
     Position is where the new gadget should go in the list.

RemoveGadget(RemPtr,Gadget)

This function removes a gadget from the gadget list of the specified window.
     RemPtr is a pointer to the window from which the gadget is to be
     removed.
     Gadget is a pointer to the gadget to be removed.

RefreshGadgets(Gadgets,Ptr,Requester)

[This function] redraws all of the gadgets in the gadget list of a window or
reqeuster, starting with the specified gadget.  You might want to use this
if you have modified the imagery of your gadgets and want to display the new
imagery.  You might also use it if you think some graphic operation has
trashed the imagery of the gadgets.

     Gadgets points to the gadget where the redrawing should start.
     Ptr points to the Window structure.
     Requester points to a requester or is NULL.

end-quote.

I hope this helps...

/****************************************************************
 *          All of the above copyright by the below.            *
 *         Bill Cavanaugh       uunet!tronsbox!bleys            *
 *    "A language is a dialect with an army and a navy."        *
 ****************************************************************/

bj@cbmvax.commodore.com (Brian Jackson) (12/16/90)

In article <1990Dec14.170205.24129@rodan.acs.syr.edu> goldberg@rodan.acs.syr.edu (Ross Goldberg) writes:
>I can not figure out how those 3 above commands work.  I need to be able
>to add and remove gadgets so I can position them where defined by the
>user.  

All three of these calls are fully documented in the "Includes &
Autodocs" Rom Kernel Manual.  (Btw, it's RemoveGadgets() - plural)

>With the 1 gadget defined, I tried to 
>RemoveGadget(my_gadget)
>(system hung)
>RemoveGadget(&my_gadget)
>(system request window began to appear and it hung)
>
>I assume it must be attached to the window (my_new_window) but can't figure
>out how and these commands are not documented anywhere that I can find.

All of these commands have the relevant window as an argument.  If you
don't have the above-mentioned manual then right now would seem a good
time to get it :)  
 
AddGadget( struct Window *, struct Gadget *, long pos_in_list )
RemoveGadget( struct Window *, struct Gadget * )
RefreshGadgets( struct Gadget *, struct Window *, struct Requester *)

bj

>thanx,
>Ross

 -----------------------------------------------------------------------
 | Brian Jackson  Software Engineer, Commodore-Amiga Inc.  GEnie: B.J. |
 | bj@cbmvax.cbm.commodore.com    or  ...{uunet|rutgers}!cbmvax!bj     |
 | 'Please dosconnect in your mind the concepts "seems to work just    |
 |  fine' and 'Is allowed' - Peter Cherna                              |
 -----------------------------------------------------------------------