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

Normally, GadTools gadgets are created and then attached to a window when
the window is opened, either through the WA_Gadget tag or the
NewWindow.FirstGadget field.  Alternately, they may be added to a window
after it is open by using the functions AddGList() and RefreshGList().

Regardless of which way gadgets are attached to a window, the program must
then call the GT_RefreshWindow() function to complete the rendering of
GadTools gadgets.  This function takes two arguments.

    void GT_RefreshWindow( struct Window *win, struct Requester *req );

This win argument is a pointer to the window that contains the GadTools
gadgets.  The req argument is currently unused and should be set to NULL.
This function should only be called immediately after adding GadTools
gadgets to a window.  Subsequent changes to GadTools gadget imagery made
through calls to GT_SetGadgetAttrs() will be automatically performed by
GadTools when the changes are made.  (There is no need to call
GT_RefreshWindow() in that case.)

As mentioned earlier, applications must always ask for notification of
window refresh events for any window that uses GadTools gadgets.  When the
application receives an IDCMP_REFRESHWINDOW message for a window,
Intuition has already refreshed its gadgets.  Normally, a program would
then call Intuition's BeginRefresh(), perform its own custom rendering
operations, and finally call EndRefresh().  But for a window that uses
GadTools gadgets, the application must call GT_BeginRefresh() and
GT_EndRefresh() in place of BeginRefresh() and EndRefresh().  This allows
the the GadTools gadgets to be fully refreshed.

    void GT_BeginRefresh( struct Window *win );
    void GT_EndRefresh ( struct Window *win, long complete );

For both functions, the win argument is a pointer to the window to be
refreshed.  For GT_EndRefresh(), set the complete argument to TRUE if
refreshing is complete, set it to FALSE otherwise.  See the discussion of
BeginRefresh() and EndRefresh() in the "Intuition Windows" chapter for
more about window refreshing.

When using GadTools gadgets, the program may not set the window's
WFLG_NOCAREREFRESH flag.  Even if there is no custom rendering to be
performed, GadTools gadgets requires this minimum code to handle
IDCMP_REFRESHWINDOW messages:

    case IDCMP_REFRESHWINDOW:
        GT_BeginRefresh(win);
        /* custom rendering, if any, goes here */
        GT_EndRefresh(win, TRUE);
        break;


[Back to Amiga Developer Docs]