Set the focus to the edit box after any of the edit box buttons are clicked

This commit is contained in:
Thomas Goyne 2012-10-10 19:01:31 -07:00
parent daf28e2005
commit cc3ca715a1
2 changed files with 10 additions and 2 deletions

View file

@ -75,7 +75,7 @@ template<class T>
struct field_setter : public std::binary_function<AssDialogue*, T, void> {
T AssDialogue::*field;
field_setter(T AssDialogue::*field) : field(field) { }
void operator()(AssDialogue* obj, T value) {
void operator()(AssDialogue* obj, T const& value) {
obj->*field = value;
}
};
@ -236,7 +236,7 @@ void SubsEditBox::MakeButton(const char *cmd_name) {
ToolTipManager::Bind(btn, command->StrHelp(), "Subtitle Edit Box", cmd_name);
MiddleBotSizer->Add(btn, wxSizerFlags().Center().Expand());
btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(cmd::call, cmd_name, c));
btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&SubsEditBox::CallCommand, this, cmd_name));
}
wxComboBox *SubsEditBox::MakeComboBox(wxString const& initial_text, int style, void (SubsEditBox::*handler)(wxCommandEvent&), wxString const& tooltip) {
@ -544,3 +544,8 @@ void SubsEditBox::OnEffectChange(wxCommandEvent &) {
void SubsEditBox::OnCommentChange(wxCommandEvent &) {
SetSelectedRows(&AssDialogue::Comment, CommentBox->GetValue(), _("comment change"), AssFile::COMMIT_DIAG_META);
}
void SubsEditBox::CallCommand(const char *cmd_name) {
cmd::call(cmd_name, c);
TextEdit->SetFocus();
}

View file

@ -198,6 +198,9 @@ class SubsEditBox : public wxPanel {
/// @brief Enable or disable frame timing mode
void UpdateFrameTiming(agi::vfr::Framerate const& fps);
/// Call a command the restore focus to the edit box
void CallCommand(const char *cmd_name);
SubsTextEditCtrl *TextEdit;
agi::scoped_ptr<TextSelectionController> textSelectionController;