Opened 13 years ago

Closed 10 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
Platform: All

Description

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 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by cipri, 13 years ago

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 by MrPingouin, 10 years ago

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 by pulkomandy, 10 years ago

Blocking: 11528 added

comment:4 by MrPingouin, 10 years ago

patch: 01

comment:5 by pulkomandy, 10 years ago

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

Can't you just add

default:
     break;

to it to avoid that?

It would look cleaner than chained if I think.

comment:6 by MrPingouin, 10 years ago

There you go.

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

comment:7 by pulkomandy, 10 years ago

Resolution: fixed
Status: newclosed

Patch applied in hrev48463. Thanks!

Note: See TracTickets for help on using tickets.