I am calling a dialog from a tree control menu as below. The OnSavePattern function follows after that.
if(itemId==A1)
{
A2Dlg A3(this, wxID_ANY);
if(A3.ShowModal()==wxID_OK)
{
A3.OnSavePattern();
wxGetApp().getPattern()->var1=1;
}
}
//////////////////////////////////////////
void A2Dlg::OnSavePattern()
{
if(radioButtonYM->GetValue())
wxGetApp().getPattern()->var2=1;
else if(radioButtonY->GetValue())
wxGetApp().getPattern()->var2=2;
else if(radioButtonM->GetValue())
wxGetApp().getPattern()->var2=3;
Refresh();
}
However, sometimes, the code does not call OnSavePattern on hitting Ok. I am not sure why this happens, and also I am not creating another instance of A2Dlg. Any help would be great. Please let me know if more explanation of the problem is needed.