Opened 5 months ago

Last modified 5 months ago

#15189 new bug

BTextControl right alignment error

Reported by: telephil Owned by: nobody
Priority: low Milestone: Unscheduled
Component: Kits/Interface Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

When using right content alignment for BTextControl and setting the text programmatically, the text overflows the control and only the first characters are visible. It is possible to have all the text visible by moving to the right with the right arrow though. Another bug arises when deleting the text afterward. The cursor is then blocked at the position of the first character instead of being on the right of the control.

Attached screenshots highlight these 2 issues:

  • Text not fully displayed
  • Cursor position once text is deleted

Here is a sample showing the first bug:

#include <Application.h>
#include <Window.h>
#include <TextControl.h>

class SampleWindow : public BWindow
{
public:
        SampleWindow(void)
                : BWindow(BRect(100, 100, 400, 150), "Sample", B_TITLED_WINDOW, 0)
        {
                BTextControl *ctl = new BTextControl(BRect(4, 4, 250, 50), NULL, 
"Text", "", new BMessage('ctl'));
                ctl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
                ctl->SetText("hello");
                AddChild(ctl);
        }

        bool QuitRequested()
        {
                be_app->PostMessage(B_QUIT_REQUESTED);
                return true;
        }
};

int
main(void)
{
        BApplication app("application/x-vnd.sample");
        SampleWindow *win = new SampleWindow;
        win->Show();
        app.Run();
        return EXIT_SUCCESS;
}

Attachments (2)

bug1.png (1.1 KB ) - added by telephil 5 months ago.
bug2.png (935 bytes ) - added by telephil 5 months ago.

Download all attachments as: .zip

Change History (3)

by telephil, 5 months ago

Attachment: bug1.png added

by telephil, 5 months ago

Attachment: bug2.png added

comment:1 by diver, 5 months ago

Component: - GeneralKits/Interface Kit
Note: See TracTickets for help on using tickets.