Allow setting wrap styles only for multi-line wxTextCtrl (widgets sample)
Wrap styles are not applicable to the single-line control and radio box to select these styles should be disabled when single-line control is active. It looks that it was intended to implement this feature with TextPage_WrapLines constant and OnUpdateUIWrapLinesCheckbox handler so we can reuse these elements.
This commit is contained in:
@@ -181,7 +181,7 @@ protected:
|
|||||||
|
|
||||||
void OnUpdateUIPasswordCheckbox(wxUpdateUIEvent& event);
|
void OnUpdateUIPasswordCheckbox(wxUpdateUIEvent& event);
|
||||||
void OnUpdateUINoVertScrollbarCheckbox(wxUpdateUIEvent& event);
|
void OnUpdateUINoVertScrollbarCheckbox(wxUpdateUIEvent& event);
|
||||||
void OnUpdateUIWrapLinesCheckbox(wxUpdateUIEvent& event);
|
void OnUpdateUIWrapLinesRadiobox(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ wxBEGIN_EVENT_TABLE(TextWidgetsPage, WidgetsPage)
|
|||||||
|
|
||||||
EVT_UPDATE_UI(TextPage_Password, TextWidgetsPage::OnUpdateUIPasswordCheckbox)
|
EVT_UPDATE_UI(TextPage_Password, TextWidgetsPage::OnUpdateUIPasswordCheckbox)
|
||||||
EVT_UPDATE_UI(TextPage_NoVertScrollbar, TextWidgetsPage::OnUpdateUINoVertScrollbarCheckbox)
|
EVT_UPDATE_UI(TextPage_NoVertScrollbar, TextWidgetsPage::OnUpdateUINoVertScrollbarCheckbox)
|
||||||
EVT_UPDATE_UI(TextPage_WrapLines, TextWidgetsPage::OnUpdateUIWrapLinesCheckbox)
|
EVT_UPDATE_UI(TextPage_WrapLines, TextWidgetsPage::OnUpdateUIWrapLinesRadiobox)
|
||||||
|
|
||||||
EVT_UPDATE_UI(TextPage_Reset, TextWidgetsPage::OnUpdateUIResetButton)
|
EVT_UPDATE_UI(TextPage_Reset, TextWidgetsPage::OnUpdateUIResetButton)
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ void TextWidgetsPage::CreateContent()
|
|||||||
wxT("best wrap"),
|
wxT("best wrap"),
|
||||||
};
|
};
|
||||||
|
|
||||||
m_radioWrap = new wxRadioBox(this, wxID_ANY, wxT("&Wrap style:"),
|
m_radioWrap = new wxRadioBox(this, TextPage_WrapLines, wxT("&Wrap style:"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
WXSIZEOF(wrap), wrap,
|
WXSIZEOF(wrap), wrap,
|
||||||
1, wxRA_SPECIFY_COLS);
|
1, wxRA_SPECIFY_COLS);
|
||||||
@@ -891,7 +891,7 @@ void TextWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
|
|||||||
event.Enable(!m_text->GetValue().empty());
|
event.Enable(!m_text->GetValue().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWidgetsPage::OnUpdateUIWrapLinesCheckbox(wxUpdateUIEvent& event)
|
void TextWidgetsPage::OnUpdateUIWrapLinesRadiobox(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
event.Enable( !IsSingleLine() );
|
event.Enable( !IsSingleLine() );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user