Opened 5 weeks ago

#18464 new defect

wxRichTextCtrl text not centering for one-line.

Reported by: GreenDragon Owned by:
Priority: normal Milestone:
Component: wxRichText Version: 3.1.1
Keywords: wxRichTextCtrl Cc:
Blocked By: Blocking:
Patch: no

Description

MCVE:

#include <wx/wx.h>
#include <wx/richtext/richtextctrl.h>

class Window : public wxFrame {
public:
	Window();
private:
	wxRichTextCtrl* te;
};

Window::Window() :
	wxFrame(NULL, -1, "Rich Text") {
	te = new wxRichTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
	te->BeginAlignment(wxTEXT_ALIGNMENT_CENTER); // centering text not working
	te->WriteText("Hello rich text!");
	te->EndAlignment();
}

class App : public wxApp {
public:
	virtual bool OnInit();
};

wxIMPLEMENT_APP(App);

bool App::OnInit() {
	Window* frame = new Window();
	SetTopWindow(frame);
	frame->Show(true);

	return true;
}

Code and info from this forum topic - https://forums.wxwidgets.org/viewtopic.php?f=1&t=46112

Change History (0)

Note: See TracTickets for help on using tickets.