Fixed weird bug related to committing on various text controls.

Originally committed to SVN as r656.
This commit is contained in:
Rodrigo Braz Monteiro 2006-12-29 21:45:22 +00:00
parent ce71322af8
commit 8f50ee08a7
2 changed files with 14 additions and 12 deletions

View file

@ -1480,6 +1480,7 @@ void FrameMain::OnToggleTags(wxCommandEvent &event) {
void FrameMain::OnEditBoxCommit(wxCommandEvent &event) { void FrameMain::OnEditBoxCommit(wxCommandEvent &event) {
// Find focus // Find focus
wxWindow *focus = FindFocus(); wxWindow *focus = FindFocus();
if (!focus) return;
// Is the text edit // Is the text edit
if (focus == EditBox->TextEdit) { if (focus == EditBox->TextEdit) {
@ -1490,11 +1491,12 @@ void FrameMain::OnEditBoxCommit(wxCommandEvent &event) {
// Other window // Other window
else { else {
wxKeyEvent keyevent; //wxKeyEvent keyevent;
keyevent.m_keyCode = WXK_RETURN; //keyevent.m_keyCode = WXK_RETURN;
keyevent.m_controlDown = true; //keyevent.m_controlDown = true;
keyevent.SetEventType(wxEVT_KEY_DOWN); //keyevent.SetEventType(wxEVT_KEY_DOWN);
focus->AddPendingEvent(keyevent); wxCommandEvent keyevent(wxEVT_COMMAND_TEXT_ENTER,focus->GetId());
focus->GetEventHandler()->AddPendingEvent(keyevent);
} }
} }

View file

@ -81,26 +81,26 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
styles.Add(_T("")); styles.Add(_T(""));
CommentBox = new wxCheckBox(this,COMMENT_CHECKBOX,_("Comment")); CommentBox = new wxCheckBox(this,COMMENT_CHECKBOX,_("Comment"));
CommentBox->SetToolTip(_("Comment this line out. Commented lines don't show up on screen.")); CommentBox->SetToolTip(_("Comment this line out. Commented lines don't show up on screen."));
StyleBox = new wxComboBox(this,STYLE_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_READONLY); StyleBox = new wxComboBox(this,STYLE_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_READONLY | wxTE_PROCESS_ENTER);
StyleBox->SetToolTip(_("Style for this line.")); StyleBox->SetToolTip(_("Style for this line."));
ActorBox = new wxComboBox(this,ACTOR_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_DROPDOWN); ActorBox = new wxComboBox(this,ACTOR_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
ActorBox->SetToolTip(_("Actor name for this speech. This is only for reference, and is mainly useless.")); ActorBox->SetToolTip(_("Actor name for this speech. This is only for reference, and is mainly useless."));
ActorBox->PushEventHandler(new IdleFieldHandler(ActorBox,_("Actor"))); ActorBox->PushEventHandler(new IdleFieldHandler(ActorBox,_("Actor")));
Effect = new HiliModTextCtrl(this,EFFECT_BOX,_T(""),wxDefaultPosition,wxSize(120,20),0); Effect = new HiliModTextCtrl(this,EFFECT_BOX,_T(""),wxDefaultPosition,wxSize(120,20),wxTE_PROCESS_ENTER);
Effect->SetToolTip(_("Effect for this line. This can be used to store extra information for karaoke scripts, or for the effects supported by the renderer.")); Effect->SetToolTip(_("Effect for this line. This can be used to store extra information for karaoke scripts, or for the effects supported by the renderer."));
Effect->PushEventHandler(new IdleFieldHandler(Effect,_("Effect"))); Effect->PushEventHandler(new IdleFieldHandler(Effect,_("Effect")));
// Middle controls // Middle controls
Layer = new HiliModTextCtrl(this,LAYER_BOX,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator()); Layer = new HiliModTextCtrl(this,LAYER_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_PROCESS_ENTER,NumValidator());
Layer->SetToolTip(_("Layer number")); Layer->SetToolTip(_("Layer number"));
StartTime = new TimeEdit(this,STARTTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20)); StartTime = new TimeEdit(this,STARTTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),wxTE_PROCESS_ENTER,NumValidator());
StartTime->SetToolTip(_("Start time")); StartTime->SetToolTip(_("Start time"));
StartTime->showModified = true; StartTime->showModified = true;
EndTime = new TimeEdit(this,ENDTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),0,NumValidator()); EndTime = new TimeEdit(this,ENDTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),wxTE_PROCESS_ENTER,NumValidator());
EndTime->SetToolTip(_("End time")); EndTime->SetToolTip(_("End time"));
EndTime->isEnd = true; EndTime->isEnd = true;
EndTime->showModified = true; EndTime->showModified = true;
Duration = new TimeEdit(this,DURATION_BOX,_T(""),wxDefaultPosition,wxSize(75,20),0,NumValidator()); Duration = new TimeEdit(this,DURATION_BOX,_T(""),wxDefaultPosition,wxSize(75,20),wxTE_PROCESS_ENTER,NumValidator());
Duration->SetToolTip(_("Line duration")); Duration->SetToolTip(_("Line duration"));
Duration->showModified = true; Duration->showModified = true;
MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator()); MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator());