How to have a text that can change in some layout ?

Online Status

Hello again.

I want to have some non-editable text displayed on the layout, and be able to change the text content.
I tried class images/label.image, I can give a text at NewObject() , but then SetAttrs(label, LABEL_Text, "blabla", TAG_END) or the setGadgetAttribs() won't work. It is said in the doc it can only be set at OM_NEW.

So I may try string.gadget which is an editor, put it in read mode, but will it look like a label ?
What's the good manner ?

Online Status

This is a common question. The best thing to use for this is a button gadget without a border. That way you can update the text with SetAttr(). A label image is meant to remain static.

Online Status

So under OS3.2 if I use "BUTTON_BevelStyle, BEVEL_Label", inside NewObject() : big problems, ...

EDIT: AAARG it's BUTTON_BevelStyle, BVS_NONE, ok.
I missed the attribs and the values reading label.h

So now, background of the button is color 0, not the layout image, and when I click my "label button" still goes blue.
Any idea to get closer to my "dynamic label" goal ?
No more clipping bug also.

Online Status

Ok, so to finish... This does Coffe:
app->label2 = NewObject( NULL, "button.gadget",
GA_DrawInfo,(ULONG) app->drawInfo,
BUTTON_BevelStyle,BVS_NONE,
BUTTON_Transparent, TRUE,
BUTTON_Justification, BCJ_CENTER,
GA_Text,(ULONG)"...",
TAG_END);

Online Status

You should use GA_ReadOnly, TRUE which will prevent the gadget doing anything when clicked on.
You can use BUTTON_BackgroundPen to get the background colour you want.