Hi,
I am currently working on a Human Machine Interface, which is just a touchscreen UI which controls a machine.
Now I want to implement help on the several buttons on this UI. What I want to do is tte following:
- the user clicks on the help button (which is a normal .Net button with a help icon)
- the form will be set in some kind of Help mode
- the user clicks another button (which is also a normal .Net button)
- a small window with some help about this button will be shown
My question is the following: how do I prevent that the normal button click event is fired when the form is in this Help mode?
Thx for your answers,
Dennieku
Loading
Jan MontanoPosted Jul 18, 2007, 9:23 PM
If you really want the click event not to trigger, you should remove it's event handler when you're to enter help mode.
this.button1.Click -= new System.EventHandler(this.button1_Click);
Then as soon as you're not in help mode anymore (maybe upon the help form's exit or whatever), you could add it back.
this.button1.Click += new System.EventHandler(this.button1_Click);
Another option would be just to have a module-level variable such as bool isHelpMode; then checking inside the button click if it is indeed not in help mode before proceeding.