Upon selecting an entry in the chapter list the name input box and the text inside is selected. If the user presses enter in that input box then the next chapter entry is selected.

This commit is contained in:
Moritz Bunkus 2005-01-22 15:58:34 +00:00
parent 08047185b2
commit ac25506561
2 changed files with 43 additions and 1 deletions

View File

@ -371,7 +371,9 @@ tab_chapters::tab_chapters(wxWindow *parent,
siz_fg->AddGrowableCol(1);
st_name = new wxStaticText(this, wxID_STATIC, wxT("Name:"));
siz_fg->Add(st_name, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 10);
tc_chapter_name = new wxTextCtrl(this, ID_TC_CHAPTERNAME, wxT(""));
tc_chapter_name = new wxTextCtrl(this, ID_TC_CHAPTERNAME, wxT(""),
wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER);
siz_fg->Add(tc_chapter_name, 1, wxGROW | wxBOTTOM, 10);
st_language = new wxStaticText(this, wxID_STATIC, wxT("Language:"));
@ -1184,6 +1186,7 @@ tab_chapters::on_entry_selected(wxTreeEvent &evt) {
lb_chapter_names->SetSelection(0);
b_remove_chapter_name->Enable(lb_chapter_names->GetCount() > 1);
tc_chapter_name->SetSelection(-1, -1);
tc_chapter_name->SetFocus();
}
@ -1797,6 +1800,43 @@ tab_chapters::on_chapter_name_selected(wxCommandEvent &evt) {
tc_chapter_name->SetFocus();
}
void
tab_chapters::on_chapter_name_enter(wxCommandEvent &evt) {
wxTreeItemId id;
wxTreeItemIdValue cookie;
id = tc_chapters->GetSelection();
if (!id.IsOk())
return;
id = tc_chapters->GetNextSibling(id);
if (id.IsOk()) {
tc_chapters->SelectItem(id);
return;
}
id = tc_chapters->GetItemParent(tc_chapters->GetSelection());
if (!id.IsOk())
return;
id = tc_chapters->GetNextSibling(id);
if (id.IsOk()) {
id = tc_chapters->GetFirstChild(id, cookie);
if (id.IsOk()) {
tc_chapters->SelectItem(id);
return;
}
}
id = tc_chapters->GetRootItem();
if (!id.IsOk())
return;
id = tc_chapters->GetFirstChild(id, cookie);
if (!id.IsOk())
return;
id = tc_chapters->GetFirstChild(id, cookie);
if (id.IsOk())
tc_chapters->SelectItem(id);
}
void
tab_chapters::on_flag_hidden(wxCommandEvent &evt) {
wxTreeItemId selected;
@ -1974,4 +2014,5 @@ BEGIN_EVENT_TABLE(tab_chapters, wxPanel)
EVT_TEXT(ID_TC_CHAPTERNAME, tab_chapters::on_chapter_name_changed)
EVT_CHECKBOX(ID_CB_CHAPTERHIDDEN, tab_chapters::on_flag_hidden)
EVT_CHECKBOX(ID_CB_CHAPTERENABLED, tab_chapters::on_flag_enabled)
EVT_TEXT_ENTER(ID_TC_CHAPTERNAME, tab_chapters::on_chapter_name_enter)
END_EVENT_TABLE();

View File

@ -93,6 +93,7 @@ public:
void on_country_code_selected(wxCommandEvent &evt);
void on_chapter_name_selected(wxCommandEvent &evt);
void on_chapter_name_changed(wxCommandEvent &evt);
void on_chapter_name_enter(wxCommandEvent &evt);
void on_add_chapter_name(wxCommandEvent &evt);
void on_remove_chapter_name(wxCommandEvent &evt);
void on_set_default_values(wxCommandEvent &evt);