T
Tim Jarvis
Hi,
I am using a toolbar object that has a number of buttons that generally
speaking have a corresponding menu item. What I was hoping to be able
to do was to write an event handler for the menu item and assign it to
the click event of the toolbar button.
But I find that the toolbar buttons don't have a click event at all, I
have to write a handler in the buttonclick event of the toolbar itself
which in turn gets a ToolbarButtonClickEventArgs param passed that I
can use to determine which button was clicked. Which leads to code like
the following
if (e.Button == btnSomething)
{
mnuSomthing_Click(this,EventArgs.Empty);
}
else
{
if (e.button == btnSomethingElse)
{
mnuSomthingElse_Click(this,EventArgs.Empty);
}
}
Surely there is a better way than this...surely.
Cheers Tim.
I am using a toolbar object that has a number of buttons that generally
speaking have a corresponding menu item. What I was hoping to be able
to do was to write an event handler for the menu item and assign it to
the click event of the toolbar button.
But I find that the toolbar buttons don't have a click event at all, I
have to write a handler in the buttonclick event of the toolbar itself
which in turn gets a ToolbarButtonClickEventArgs param passed that I
can use to determine which button was clicked. Which leads to code like
the following
if (e.Button == btnSomething)
{
mnuSomthing_Click(this,EventArgs.Empty);
}
else
{
if (e.button == btnSomethingElse)
{
mnuSomthingElse_Click(this,EventArgs.Empty);
}
}
Surely there is a better way than this...surely.
Cheers Tim.