Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
38 user(s) are online (27 user(s) are browsing Forums)

Members: 0
Guests: 38

more...

Support us!

Headlines

 
  Register To Post  

How to replace object in Reaction?
Just popping in
Just popping in


See User information
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->winobjNULLLAYOUT_ModifyChildr->objs[FID_PREVIEW], CHILD_ReplaceObjectobjTAG_DONE) == 1)
    {
        
RethinkLayout(r->objs[FID_PREVIEWPARENT], r->windowNULLTRUE);
    }

    if (
DoMethod(r->winobjWM_RETHINK) == 0)
        
DoMethod(r->winobjWM_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 *rstruct TextAttr *font)
{
    return 
LabelObject,
        
IA_Fontfont,
        
LABEL_JustificationLJ_CENTRE,
        
LABEL_Text"foobared",
    
End;
}

LAYOUT_AddChildr->objs[FID_PREVIEWPARENT] = LayoutObject,
    
CHILD_Labelr->objs[FID_PREVIEW] = CreateTextPreview(rr->textattr),
End,


Go to top
Re: How to replace object in Reaction?
Just can't stay away
Just can't stay away


See User information
@porthan

CHILD_ReplaceObject is for gadgets only. For images you should use CHILD_ReplaceImage instead.

BTW if you just want a text area that you can change on the fly it's much simpler to use a borderless button and change the GA_Text with SetGadgetAttrs().

Go to top
Re: How to replace object in Reaction?
Just popping in
Just popping in


See User information
Oh, I see. I try latter method, it is smarter.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project