Calling Menu_AppendTextItem(…) automatically adds two items (commit changes, discard changes) with the textbox to the menu. How can I subscribe to events raised by clicking on either of one? I only want to start doing something with the new input of the textbox once the user has commited the change.
By calling Menu_AppendTextItem(…) i can only subscribe to TextBoxChanged, which would lead to automatically parse content every time the user types something (including typos etc.)
Thanks!
I saw it, but I was out-of-office for a few days and had to prepare for the trip as well. I now have some time to look into it again. Sorry about the delay.
No worries… for now I worked around it by putting the textbox in a dropdown, and accessing it like that:
ToolStripTextBox textBox= Menu_AppendTextItem(subMenu.DropDown,
this.tol.ToString(),
(obj, e) => { },
Menu_TextBoxChanged,
true);
subMenu.DropDown.Items[1].Click += (obj, e) => OK_Click(obj, e, tolerance);
subMenu.DropDown.Items[2].Click += (obj, e) => Cancel_Click(obj, e, tolerance);
However it seems a bit awkward accessing those list items in that way, i figured that there should have been some overload of the Menu_AppendTextItem methods where one can specify the corresponding event handlers.