Merge branch 'msw-long-text'
Fixes for creating wxTextCtrl with long text in wxMSW. See https://github.com/wxWidgets/wxWidgets/pull/2570 Closes #19303.
This commit is contained in:
@@ -97,7 +97,11 @@ bool wxTextEntryDialog::Create(wxWindow *parent,
|
|||||||
topsizer->Add(CreateTextSizer(message), flagsBorder2);
|
topsizer->Add(CreateTextSizer(message), flagsBorder2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 2) text ctrl
|
// 2) text ctrl: create it with wxTE_RICH2 style to allow putting more than
|
||||||
|
// 64KiB of text into it
|
||||||
|
if ( style & wxTE_MULTILINE )
|
||||||
|
style |= wxTE_RICH2;
|
||||||
|
|
||||||
m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
|
m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
|
||||||
wxDefaultPosition, wxSize(300, wxDefaultCoord),
|
wxDefaultPosition, wxSize(300, wxDefaultCoord),
|
||||||
style & ~wxTextEntryDialogStyle);
|
style & ~wxTextEntryDialogStyle);
|
||||||
|
@@ -583,7 +583,22 @@ bool wxTextCtrl::MSWCreateText(const wxString& value,
|
|||||||
m_updatesCount = -2;
|
m_updatesCount = -2;
|
||||||
|
|
||||||
if ( !MSWCreateControl(windowClass.t_str(), msStyle, pos, size, valueWin) )
|
if ( !MSWCreateControl(windowClass.t_str(), msStyle, pos, size, valueWin) )
|
||||||
|
{
|
||||||
|
// There is one case in which window creation may realistically fail
|
||||||
|
// and this is when we create a plain EDIT control with too long text,
|
||||||
|
// so try to detect this and transparently switch to using RICHEDIT in
|
||||||
|
// this case (note that the exact length cut off is unknown and might
|
||||||
|
// be system-dependent, but even though plain EDIT works for texts
|
||||||
|
// longer than 64KiB, we don't lose much by trying to use RICHEDIT if
|
||||||
|
// creating it failed).
|
||||||
|
if ( !HasFlag(wxTE_RICH | wxTE_RICH2) && value.length() >= 0x10000 )
|
||||||
|
{
|
||||||
|
m_windowStyle |= wxTE_RICH2;
|
||||||
|
return MSWCreateText(value, pos, size);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_updatesCount = -1;
|
m_updatesCount = -1;
|
||||||
|
|
||||||
|
@@ -4049,8 +4049,8 @@ WXHWND wxWindowMSW::MSWCreateWindowAtAnyPosition(WXDWORD exStyle, const wxChar*
|
|||||||
{
|
{
|
||||||
wxLogLastError(wxString::Format
|
wxLogLastError(wxString::Format
|
||||||
(
|
(
|
||||||
wxT("CreateWindowEx(\"%s\", flags=%08lx, ex=%08lx)"),
|
wxT("CreateWindowEx(\"%s\", flags=%08lx, ex=%08lx, title-len=%zu)"),
|
||||||
clName, style, exStyle
|
clName, style, exStyle, title ? wxStrlen(title) : 0
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else if ( !IsTopLevel() && !MSWIsPositionDirectlySupported(x, y) )
|
else if ( !IsTopLevel() && !MSWIsPositionDirectlySupported(x, y) )
|
||||||
|
Reference in New Issue
Block a user