I'm working on a basic calculator (because n00b) and it works pretty well. I've gotten it to tab between the two main text controls, but it doesn't seem to work with the radio buttons. As far as I can deduce, TextCtrl2->HasFocus() returns true (if I put a wxMessageBox there it shows up at runtime) but AddButton->HasFocus() never returns true.
Are RadfioButtons different? Am I evaluating the wrong condition here?
Here's the relevant code:
Code: Select all
void wxtestFrame::OnNavigationKey(wxNavigationKeyEvent& event){
wxCommandEvent ev;
if(TextCtrl1->HasFocus()){
TextCtrl2->SetFocus();
}else if(TextCtrl2->HasFocus()){
//wxMessageBox("TextCtrl2 had focus");
AddButton->SetFocus();
AddButton->SetValue(true);
wxtestFrame::OnAddButtonSelect(ev);
}else if(AddButton->HasFocus()){
wxMessageBox("Add Button sent this"); /* This message box never shows up, I must be evaluating the wrong condition. */
SubButton->SetFocus();
SubButton->SetValue(true);
wxtestFrame::OnSubButtonSelect(ev);
}else if(SubButton->HasFocus()){
MultButton->SetFocus();
MultButton->SetValue(true);
wxtestFrame::OnMultButtonSelect(ev);
}else if(MultButton->HasFocus()){
DivideButton->SetFocus();
DivideButton->SetValue(true);
wxtestFrame::OnDivideButtonSelect(ev);
}else if(Button1->HasFocus()){
ClearBtn->SetFocus();
wxMessageBox("Calc>Clear");
}else if(ClearBtn->HasFocus()){
TextCtrl1->SetFocus();
wxMessageBox("Clear>Text1");
}
}
Thanks.