Windows Develop Bookmark and Share   
 index > Windows Forms General > Implementing help in touchscreen UI
 

Implementing help in touchscreen UI

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 in this UI. What I want to do is the 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
Dennieku  Wednesday, July 18, 2007 7:43 AM
Try this:

private void button1_Click(object sender, EventArgs e) {
// Send WM_SYSCOMMAND, SC_CONTEXTHELP
button1.Capture = false;
SendMessage(this.Handle, 0x112, (IntPtr)0xf180, IntPtr.Zero);
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);

nobugz  Wednesday, July 18, 2007 6:53 PM
I'm not sure why you'd want to disable the click event. How do you intend to respond to the click on a button in help mode if not through the click event? If I was doing this I would have a help mode flag on my form and in each click event for each control I would get the help mode flag. If it's set then do whatever help function you're supposed to do, else behave normally.
wjousts  Wednesday, July 18, 2007 12:00 PM

Hi,

Thx for your answer!

I do not want to place this Help logic in the controls on the form, but only in the form itself.

So when Help mode is on, the form must capture the mouse(down or click?)event and perform the action to show a Help screen. The actual click event of the control on the form shouldthen not be handled.

Regards,

Dennieku

Dennieku  Wednesday, July 18, 2007 1:55 PM
Try this:

private void button1_Click(object sender, EventArgs e) {
// Send WM_SYSCOMMAND, SC_CONTEXTHELP
button1.Capture = false;
SendMessage(this.Handle, 0x112, (IntPtr)0xf180, IntPtr.Zero);
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);

nobugz  Wednesday, July 18, 2007 6:53 PM

You can use google to search for other answers

Custom Search

More Threads

• Problem with visual inheritance from form within the project. (COM Error something I don't understand)
• updating dataset values in database+windows
• Load dynamic window form using define XML & XSLT
• Error while setting up the CAS
• WebBrowser Steals Focus
• UserControl height not changing above 32767
• Add Button in datagrid
• how to pass values to another windows application?
• userControl problem
• Printing a DataGrid in VB.Net