Opened 7 years ago

Closed 4 years ago

#8391 closed bug (fixed)

BTextView::SetAlignment Bug?

Reported by: cipri Owned by: axeld
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1/alpha3
Keywords: Cc:
Blocked By: Blocking: #11528
Has a Patch: yes Platform: All


SetAlignment works fine, but not if you call SetWordWrap(false). Then it's aligned to the left and you can not change it. Is that intentional? Because it would be useful, for example for the BTextControl, so be able to make the text being centered and not aligned to the left.

Attachments (1)

0001-Fix-alignment-in-TextControl-widgets-fixes-8391.patch (2.0 KB) - added by MrPingouin 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by cipri

For example, even if wordwrap is set to false, the text could be aligned to the left just in the case, that the string/text doesnt fit fully in the visible area. And if it fits, it could align like the user wants.

comment:2 Changed 4 years ago by MrPingouin

PulkoMandy sent me there because of EasyTask #11528 and the non-centered text in the Mouse Preferences' TextControl.

After some checking, it seems that _BTextInput_::AlignTextRect() ignores the value of BTextView::Alignment().

I have a modified functional version of TextInput.cpp which correctly deals with B_ALIGN_LEFT|RIGHT|CENTER alignment values.

I still need to verify that the very few lines I've added are conform to the coding guidelines and to prepare the patch.

comment:3 Changed 4 years ago by pulkomandy

Blocking: 11528 added

comment:4 Changed 4 years ago by MrPingouin

Has a Patch: set

comment:5 Changed 4 years ago by pulkomandy

// The switch statement raises a warning about unprocessed 
// vertical alignment values 

Can't you just add


to it to avoid that?

It would look cleaner than chained if I think.

comment:6 Changed 4 years ago by MrPingouin

There you go.

But it makes me think, should I process Vertical Alignment too ? Or do we keep this for now ?

comment:7 Changed 4 years ago by pulkomandy

Resolution: fixed
Status: newclosed

Patch applied in hrev48463. Thanks!

Note: See TracTickets for help on using tickets.