Button GA_Text and BUTTON_SoftStyle change

Online Status

Hello,

I've noticed something strange (but maybe normal after all).

If I change BUTTON_SoftStyle to FSF_BOLD, the button text is updated, a little wider, which seems normal, but the button width itself is not and the text is therefore truncated on the last character.

It's easy to reproduce by slighly modifying SDK example Buttons.c :

...
#include <gadgets/button.h> //Required for BUTTON_SoftStyle
...
//I use Button_Object var (Object *) to store the address of the first button
StartMember, Button_Object = ButtonObject,
GA_Text, "Button",
EndMember,
...
//I update button style after Window opening
if( window = (struct Window *) RA_OpenWindow(Win_Object) )
{
SetGadgetAttrs((struct Gadget *)Button_Object,window,NULL, BUTTON_SoftStyle,FSF_BOLD, TAG_DONE);

=> The first button is now displayed in bold, but width of button didn't change so we only see "Butto" on the screen (and not "button").

The question is : should it be automatically enlarged ? It seems that's the case on AmigaOS 4.

=> How can I force button enlargment? I try a DoMethod (Win_Object,WM_RETHINK); but without any success.

Thanks.

Online Status

Online Status

Actually it is not enlarged on OS4, the buttons are all still 51*20 pixels.

Anyway OS3.2 is not allocating enough room when bold is used; the bug can be seen just by adding BUTTON_SoftStyle, FSF_BOLD to the first button at creation time. We will get this fixed; thanks.

Online Status

You're welcome.

Is there a way to force the button's enlargement?

Online Status

Passing GA_Text again and then doing WM_RETHINK should be enough to force a recalculaton, but as mentioned the algorithm is wrong when FSF_BOLD is used.

If you use BUTTON_TextPadding that will probably add enough that the bolded version will fit.