Windows Forms Annoyances 3.
OK, time for part 3 of my Win Forms rant. This time: Help.
First off, support for user help is heading in the right direction, but there are a couple of problems with the implementation as it stands:
- What's This? help is implemented badly; you want all your help topics in a compiled help file (.chm). So, your BA will compose help in RoboHelp, and create a help topic for every control on your form; the idea being that the user will click on either the question mark icon in your form, then click the control s/he wants information on (or they hit F1). Unfortunately, in Win Forms, the HelpNavigator's SetHelpString() method (which is designed for What's This? Help) only takes a string as a parameter - the implication being that the help topic text should be hard-coded into your app or come from a resource file. This is obviously flawed, and means you have to resort to using the HTML Help API to get your What's This? help topics out of your help file.
- Also, for What's This? help, you need to associate each control on a form with a help topic; of course, there's no integral way to do this as Win Forms stands, so you are forced to use the Control's Tag property to store the Help Topic ID. Again, not ideal.
- The HelpRequested event - great, an event that tells us when the user requested help for our form; we can use this to get the control that the user wants help for; the event doesn't tell us this - all it gives us is the mouse position. So we need to use this data to find where the user clicked the mouse in order to locate that control. Unfortunately, this event could be fired in one of two ways: by clicking the little question mark in the form banner (the mouse pointer turns into a little "question mark" icon) then clicking on a control, or by setting focus to a control and hitting the F1 key. So, when we attempt to locate that control with the Point the HelpEventArgs provides, how do we determine whether or not the user clicked F1? I mean, imagine that the user leaves the mouse hovering over an OK button, then tabs to a TextBox and hits F1 - what help topic do we show? The one for the OK button, or the textbox? We really don't know what the user did, so we have to "guess" what topic to show. Fiddly & error prone.

0 Comments:
Post a Comment
<< Home