Hi,
I have a checked menu in my application. There is also a dialog which has a check box. Whenever the user checks/unchecks the check box, I want to update the status of the menu as well. How can I do this? (I thought of sending an event to the main frame where the menu is placed, but how can I make update the menu's status??)
Thank you very much.
Lloyd
Sending menu Event Topic is solved
Use the EVT_UPDATE event:
This function is called before the menu is displayed to let you enable/disable items but also select radio menu items or check them regarding your "app config".
Then, in your dialog box, you just need to memorize the bool flag in the "app config".
You can have a look at some samples. There are several using this functionality.
Code: Select all
void your_handler::OnUpdateUI (wxUpdateUIEvent &evt);
Then, in your dialog box, you just need to memorize the bool flag in the "app config".
You can have a look at some samples. There are several using this functionality.
Re: Sending menu Event
Lloyd wrote:Hi,
I have a checked menu in my application. There is also a dialog which has a check box. Whenever the user checks/unchecks the check box, I want to update the status of the menu as well. How can I do this? (I thought of sending an event to the main frame where the menu is placed, but how can I make update the menu's status??)
Thank you very much.
Lloyd
Code: Select all
void MyFrame::OnCheckbox1Click( wxCommandEvent& event )
{
if ( check1->GetValue() )
{
menu1->FindItemByPosition(0)->Check(true);
}
else
{
menu1->FindItemByPosition(0)->Check(false);
}
}
void MyFrame::OnMenuitemClick( wxCommandEvent& event )
{
if ( menu1->FindItemByPosition(0)->IsChecked() )
{
check1->SetValue(true);
}
else
{
check1->SetValue(false);
}
}
check1 is the wxCheckBox
vista 64bit, OS X 10.4.x, OS X 10.3.9 x 2
(virtualization: vista 32bit, MS XP, MS95, MS98, Debian 3.1, Slackware 12, FreeBSD 6.1, a few more)
wx: 2.8.8/9 (unicode)
compilers: gcc (GTK+2, OS X), vc++6(MSW)
(virtualization: vista 32bit, MS XP, MS95, MS98, Debian 3.1, Slackware 12, FreeBSD 6.1, a few more)
wx: 2.8.8/9 (unicode)
compilers: gcc (GTK+2, OS X), vc++6(MSW)