79726536

Date: 2025-08-05 18:59:36
Score: 0.5
Natty:
Report link

Per https://users.polytech.unice.fr/~buffa/cours/X11_Motif/motif-faq/part5/faq-doc-43.html

Setting XmNrecomputeSize to false should work.

Updated code:

initial setup:

lbl1TextHint = XmStringCreateLocalized("Waiting for click");
lbl1 = XtVaCreateManagedWidget("label1",
                               xmLabelWidgetClass, board,
                               XmNlabelString, lbl1TextHint,
                               XmNx, 240,     // X position
                               XmNy, 20,      // Y position
                               XmNwidth, 200, // Width
                               XmNheight, 40, // Height
                               XmNrecomputeSize, False, // Do not Recompute size
                               NULL);

update label:

XtVaSetValues(lbl1, XmNlabelString, newLabel,NULL);

Updating the label keeps the same dimensions as initial setup.

Thanks to @n.m.couldbeanAI for the link in the question comments

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Joshua Penn