I want to be able to toggle between different layout gadgets. So if user clicks on one button, it will display layout, and if he clicks on another button, it will display layout3, for example. How do I add/remove layout gadgets to my window? I've experimented with AddGList() AddGadgets() RemoveGList() RemoveGadget() RefreshGList() etc etc to no avail. When I try to change the layout gadget for the window to something else, it will display only the listbrowser part of the layout gadget, the string gadget is nowhere to be found, and its not displayed correctly.. it appears in the corner of the window overlapping the close window gadget, and isnt updated when I resize the window.. When I use SetAttrs(), it works once if theres no layout gadget for the window yet.. otherwise it will just crash my program.
Help..
layout2=(Gadget*)LayoutObject,
LAYOUT_DeferLayout, TRUE,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BottomSpacing, 4,
LAYOUT_HorizAlignment, LALIGN_LEFT,
LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
GA_RelVerify, TRUE,
CHILD_MaxHeight, screen->Font->ta_YSize,
LAYOUT_AddChild,
ButtonObject,
GA_Text, "Status",
ButtonEnd,
LayoutEnd;
layout=(Gadget*)LayoutObject,
LAYOUT_DeferLayout, TRUE,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BottomSpacing, 4,
LAYOUT_HorizAlignment, LALIGN_RIGHT,
LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
LAYOUT_AddChild, ListBrowserObject,
GA_RelVerify, TRUE,
LISTBROWSER_Labels, (ULONG)&lb_list1,
//LISTBROWSER_ColumnInfo, &ci1,
LISTBROWSER_AutoFit, TRUE,
LISTBROWSER_MultiSelect, TRUE,
LISTBROWSER_ShowSelected, TRUE,
LISTBROWSER_Separators, TRUE,
LISTBROWSER_Editable, TRUE,
LISTBROWSER_Spacing, 1,
ListBrowserEnd,
LAYOUT_AddChild,StringObject,
StringEnd,
LAYOUT_AddChild, layout2,
LayoutEnd;
layout3=(Gadget*)layout;
if (window_obj = (Object*)WindowObject,
WA_Left, 0,
WA_Width, 640,
WA_Height, 480,
WA_Top, screen->Font->ta_YSize + 3,
WA_CustomScreen, screen,
WA_IDCMP, IDCMP_CLOSEWINDOW,
WA_Flags, WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_SIZEGADGET | WFLG_ACTIVATE | WFLG_SMART_REFRESH,
WA_Title, "test",
WINDOW_Layout, layout3,
WINDOW_IconifyGadget, TRUE,
WINDOW_Icon, GetDiskObject("PROGDIR:ReAction"),
WINDOW_IconTitle, "ReAction Demo",
WINDOW_AppPort, app_port,
EndWindow)
win = RA_OpenWindow(window_obj);
//SetAttrs(window_obj, WINDOW_Layout, layout);
RemoveGList(win, layout3, -1);
AddGList(win, layout, -1, -1, NULL);
RefreshGList(layout,win, NULL, -1);