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;