Focus the frame number field of the Jump To dialog when it's opened

Originally committed to SVN as r6302.
This commit is contained in:
Thomas Goyne 2012-01-17 02:47:37 +00:00
parent cf6f54720d
commit 96211b79cf
2 changed files with 12 additions and 0 deletions

View file

@ -96,6 +96,7 @@ DialogJumpTo::DialogJumpTo(agi::Context *c)
SetSizerAndFit(MainSizer); SetSizerAndFit(MainSizer);
CenterOnParent(); CenterOnParent();
Bind(wxEVT_INIT_DIALOG, &DialogJumpTo::OnInitDialog, this);
Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogJumpTo::OnOK, this); Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogJumpTo::OnOK, this);
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogJumpTo::OnOK, this, wxID_OK); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogJumpTo::OnOK, this, wxID_OK);
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&DialogJumpTo::EndModal, this, 0), wxID_CANCEL); Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&DialogJumpTo::EndModal, this, 0), wxID_CANCEL);
@ -103,6 +104,15 @@ DialogJumpTo::DialogJumpTo(agi::Context *c)
JumpFrame->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogJumpTo::OnEditFrame, this); JumpFrame->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogJumpTo::OnEditFrame, this);
} }
void DialogJumpTo::OnInitDialog(wxInitDialogEvent&) {
TransferDataToWindow();
UpdateWindowUI(wxUPDATE_UI_RECURSE);
// This can't simply be done in the constructor as the value hasn't been set yet
JumpFrame->SetFocus();
JumpFrame->SelectAll();
}
void DialogJumpTo::OnOK(wxCommandEvent &) { void DialogJumpTo::OnOK(wxCommandEvent &) {
EndModal(0); EndModal(0);
c->videoController->JumpToFrame(std::min<int>(jumpframe, c->videoController->GetLength() - 1)); c->videoController->JumpToFrame(std::min<int>(jumpframe, c->videoController->GetLength() - 1));

View file

@ -54,6 +54,8 @@ class DialogJumpTo : public wxDialog {
void OnEditTime(wxCommandEvent &event); void OnEditTime(wxCommandEvent &event);
/// Update target time on target frame changed /// Update target time on target frame changed
void OnEditFrame(wxCommandEvent &event); void OnEditFrame(wxCommandEvent &event);
/// Dialog initializer to set default focus and selection
void OnInitDialog(wxInitDialogEvent&);
public: public:
/// Constructor /// Constructor