[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


    NAME
	OnGadget -- Enable the specified gadget.

    SYNOPSIS
	OnGadget( Gadget, Window, Requester )
		  A0      A1      A2

	VOID OnGadget( struct Gadget *, struct Window *,
		struct Requester * );

    FUNCTION
	This command enables the specified gadget.  When a gadget is
	enabled, these things happen:
        - its imagery is displayed normally (not ghosted)
        - the GFLG_DISABLED flag is cleared
        - the gadget can thereafter be selected by the user

	The window parameter must point to the window which contains the
	gadget, or which contains the requester that contains the gadget
	The requester parameter must only be valid if the gadget has the
	GTYP_REQGADGET flag set, a requirement for all requester gadgets.

       NOTE:  it's never safe to tinker with the gadget list yourself.  Don't
       supply some gadget that Intuition hasn't already processed in
       the usual way.

    	NOTE: for compatibility reasons, this function will refresh all
	gadgets in a requester, and all gadgets from gadget to the
	end of the gadget list if gadget is in a window.

	If you want to improve on this behavior, you may perform the
	equivalent operation yourself: remove a gadget or gadgets,
	change the state of their GFLG_DISABLED flag, replace the
	gadgets using AddGList(), and selectively call RefreshGList().

    INPUTS
	Gadget = pointer to the gadget that you want disabled
	Window = pointer to a window structure containing the gadget or
	    containing the requester which contains the gadget
	Requester = pointer to a requester (may by NULL if this isn't
           a requester gadget (i.e. GTYP_REQGADGET is not set)).

    RESULT
	None

    BUGS
	Traditional gadgets are rendered very simply.  This can result
	in incomplete clearing away of the ghosting pattern when
	OnGadget() is used.  For example, a button whose imagery consists
	of an IntuiText inside a rectangular Border doesn't have the
	button interior cleared by OnGadget().  This is because OnGadget()
	clears the GFLG_DISABLED flag then redraws the gadget.  Redrawing
	this gadget consists of redrawing the border and text.  Nothing
	redraws the field.

	The solution to this type of problem is to either use a gadget
	whose imagery is a struct Image that covers the whole select area,
	or to manually remove the gadget, erase the gadget's select area
	(say using EraseRect()), then clear the GFLG_DISABLED flag,
	add the gadget back to the window, and refresh it.

    SEE ALSO
	OffGadget()