If the dev enters an invalid path for the compiler manually or by selecting a wrong directory the current code allows the user to do this and on the next CB start shows the auto-detection dialog because the compiler is configured incorrectly.
I can add the following for when the masterpath focus is lost, which works correctly w.r.t calling the CompilerOptionsDlg::OnMasterPathKillFocus function.
// Setup on focus kill on masterpath to validate manual updates.
XRCCTRL(*this, "txtMasterPath", wxTextCtrl)->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(CompilerOptionsDlg::OnMasterPathKillFocus), NULL, this);
The OnMasterPathKillFocus could look like the following with more checking added like in the auto detection code as this is a P.O.C. for adding in the kill focus and a pop up, but it currently has an issue where the focus is left on the control you clicked on, but it is like the left mouse button is selected and there is no flashing icon in the text controls if you selected one.
void CompilerOptionsDlg::OnMasterPathKillFocus(wxFocusEvent& event)
{
wxTextCtrl *wtcMasterPath = wxDynamicCast(event.GetEventObject(), wxTextCtrl);
wxString path = wtcMasterPath->GetValue();
if (path.IsEmpty() || !wxDirExists(path)) // NEED TO ADD CHECK FOR BIN/{compiler file} LIKE auto detect code!!!!
{
switch(cbMessageBox(_("You have entered an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!] path. Do you want use this path?\n\n"
"Yes : will save the invalid path\n"
"No : will not save and allow you to change the path\n"),
_("invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!] path detected"),
wxICON_EXCLAMATION|wxYES|wxNO))
{
case wxID_YES :
DoSaveCompilerPrograms();
break;
case wxID_NO :
default:
break;
} // end switch
}
// THE FOLLOWING BLOCK DOES NOT WORK!!!!
XRCCTRL(*this, "tabPrograms", wxPanel)->SetFocus();
//XRCCTRL(*this, "tabPrograms", wxPanel)->Update();
XRCCTRL(*this, "tabPrograms", wxPanel)->Update();
event.Skip();
}
Do you think the concept of checking the compiler path at the point of entry like I am proposing above is a good idea or not?
If you think this is a good idea, but do not like the yes option then let me know or if there are any other changes you can think of let me know.
If you think this is a good idea then do you have any pointers or ideas on how or where I can look to fix the focus issue I would be very geatfull as I am not a wxwidget guru and have only done a simple simulation GUI in wxwidgets (a single dialog with may bee 30 controls) to simulate some poker machine peripherals like a ticket printer, bill acceptor and coin mechanism.