Minor fixes to wxRichTextCtrlXmlHandler code and docs

Fix the example showing how to use it in the docs.

Don't use "maxlength" property for this control, as it's ignored by it
anyhow.

Closes #22467.
This commit is contained in:
Randalphwa
2022-05-27 10:34:23 -07:00
committed by Vadim Zeitlin
parent 5b078655ed
commit d9f36adc8f
3 changed files with 7 additions and 11 deletions

View File

@@ -1930,19 +1930,17 @@ a single wxSizer child with non-ribbon windows in it.
@hdr3col{property, type, description} @hdr3col{property, type, description}
@row3col{value, @ref overview_xrcformat_type_text, @row3col{value, @ref overview_xrcformat_type_text,
Initial value of the control (default: empty).} Initial value of the control (default: empty).}
@row3col{maxlength, integer,
Maximum length of the text entered (default: unlimited).}
@endTable @endTable
Notice that wxRichTextCtrl support in XRC is available in wxWidgets 2.9.5 and Notice that you need to explicitly register the handler using
later only and you need to explicitly register its handler using
@code @code
#include <wx/xrc/xh_richtext.h> #include <wx/xrc/xh_richtext.h>
AddHandler(new wxRichTextCtrl); AddHandler(new wxRichTextCtrlXmlHandler);
@endcode @endcode
to use it. to use it.
@since 2.9.5
@subsubsection xrc_wxscrollbar wxScrollBar @subsubsection xrc_wxscrollbar wxScrollBar

View File

@@ -1404,8 +1404,7 @@ wxRichTextCtrl =
attribute class { "wxRichTextCtrl" } & attribute class { "wxRichTextCtrl" } &
stdObjectNodeAttributes & stdObjectNodeAttributes &
stdWindowProperties & stdWindowProperties &
[xrc:p="o"] element value {_, t_text }* & [xrc:p="o"] element value {_, t_text }*
[xrc:p="o"] element maxlength {_, t_integer }*
} }

View File

@@ -24,7 +24,9 @@ wxRichTextCtrlXmlHandler::wxRichTextCtrlXmlHandler() : wxXmlResourceHandler()
XRC_ADD_STYLE(wxTE_PROCESS_TAB); XRC_ADD_STYLE(wxTE_PROCESS_TAB);
XRC_ADD_STYLE(wxTE_MULTILINE); XRC_ADD_STYLE(wxTE_MULTILINE);
XRC_ADD_STYLE(wxTE_READONLY); XRC_ADD_STYLE(wxTE_READONLY);
XRC_ADD_STYLE(wxTE_AUTO_URL);
XRC_ADD_STYLE(wxRE_CENTRE_CARET);
XRC_ADD_STYLE(wxRE_READONLY);
AddWindowStyles(); AddWindowStyles();
} }
@@ -43,9 +45,6 @@ wxObject *wxRichTextCtrlXmlHandler::DoCreateResource()
SetupWindow(text); SetupWindow(text);
if (HasParam(wxT("maxlength")))
text->SetMaxLength(GetLong(wxT("maxlength")));
return text; return text;
} }