Hi,
I am trying to replace Reaction object in my GUI but I can't get it working. What is correct procedure to replace objects?
APTR obj = CreateTextPreview(r, &r->TextAttr);
if (obj)
{
if (SetGadgetAttrs(r->objs[FID_PREVIEWPARENT], r->winobj, NULL, LAYOUT_ModifyChild, r->objs[FID_PREVIEW], CHILD_ReplaceObject, obj, TAG_DONE) == 1)
{
RethinkLayout(r->objs[FID_PREVIEWPARENT], r->window, NULL, TRUE);
}
if (DoMethod(r->winobj, WM_RETHINK) == 0)
DoMethod(r->winobj, WM_NEWPREFS);
r->objs[FID_PREVIEW] = obj;
}
WM_RETHINK and WM_NEWPREFS were used in ClassACt sample code demonstrating dynamic GUI changes but seems these methods do nothing. RethinkLayout() I found from layout.gadget documentation but it does nothing either.
I tried RefreshGList() but it crashes.
static APTR CreateTextPreview(struct Data *r, struct TextAttr *font)
{
return LabelObject,
IA_Font, font,
LABEL_Justification, LJ_CENTRE,
LABEL_Text, "foobared",
End;
}
LAYOUT_AddChild, r->objs[FID_PREVIEWPARENT] = LayoutObject,
CHILD_Label, r->objs[FID_PREVIEW] = CreateTextPreview(r, r->textattr),
End,