.NET Forum / Windows Forms / WinForm General / March 2007
Opinion wanted
|
|
Thread rating:  |
Jack White - 02 Mar 2007 23:23 GMT Hi there,
Is there a general approach for preventing users from selecting a menu item in an SDI or MDI application whenever the current field on your form is invalid (assuuming the app consists of a data entry form). In my case, I'm working with a "DataGridView" which occupies the entire child window of an MDI app but the problem likely applies to any control. If you've entered invalid data into a "TextBox" field of a form for instance (in my case a grid cell), it's likely that most if not all items in your menus as well as most hotkeys should be off-limits until the user corrects the field. Without taking great pain to prevent users from gaining access to these items however (it's not always trivial), is there an easier approach. Thanks.
justin creasy - 03 Mar 2007 01:32 GMT > Hi there, > [quoted text clipped - 8 lines] > taking great pain to prevent users from gaining access to these items > however (it's not always trivial), is there an easier approach. Thanks. Jack:
Are you asking how to validate the users data, or how to act once validation has been processed?
Jack White - 03 Mar 2007 01:59 GMT > Jack: > > Are you asking how to validate the users data, or how to act once > validation has been processed? I'm really asking if there's a mainstream way to prevent users from selecting menu items or activating hot keys when they try to leave a control that currently has invalid data in it. Relying on the "Control.Validating" event for instance works fine for other controls (preventing the user from selecting them) but it doesn't prevent users from selecting a menu item. Most menu items however (and hot keys) are probably invalid at this stage as well (just like other controls) but the user can click them anyway. The plumbing involved to manually prevent it is often non-trivial and inconsistent with the "Control.Validating" model. I'm wondering how others handle this. Thanks for the feedback.
Bryan Phillips - 03 Mar 2007 13:11 GMT I use the Composite UI App block (CAB) which allows you to map menu items, etc... to commands which I disable. When the command is disabled, everything mapped to it is also disabled. The same thing happens for hiding commands.
-- Bryan Phillips MCSD, MCDBA, MCSE Blog: http://bphillips76.spaces.live.com
> > Jack: > > [quoted text clipped - 11 lines] > inconsistent with the "Control.Validating" model. I'm wondering how others > handle this. Thanks for the feedback. Jack White - 04 Mar 2007 17:24 GMT >I use the Composite UI App block (CAB) which allows you to map menu items, >etc... to commands which I disable. When the command is disabled, >everything mapped to it is also disabled. The same thing happens for >hiding commands. I'll take a look at this. Thanks. Note however that disabling items is only part of the story. When you write a "Control.Validating" handler for instance, you'll typically display an error message for the user if the current control is invalid and then cancel the event by setting "CancelEventArgs.Cancel" to "true". This prevents users from changing focus to another control. Since this doesn't prevent users from clicking a menu item however (using the mouse or an accelerator key), you would have to disable/enable these items at the very moment the control becomes invalid/valid. Doing this isn't trivial however (it means validating a textbox on every keystroke for instance) but even if you do disable them, there's no feedback for the user as to why these items are suddenly disabled. Instead, when they click a menu item (or use a hotkey), they should see the same consistent error message that's normally displayed by "Control.Validating". Unfortunately, wiring this all up is not a simple task.
Michael C - 05 Mar 2007 04:37 GMT > I'll take a look at this. Thanks. Note however that disabling items is > only part of the story. When you write a "Control.Validating" handler for [quoted text clipped - 11 lines] > "Control.Validating". Unfortunately, wiring this all up is not a simple > task. IMO, you are going to a lot of trouble to make your app worse. Restricting the user to a particular control when it is invalid is one of the worst and most annoying UI designs possible. It gives your app a very unprofessional feel and a large number of users will uninstall it as soon as they encounter this feature (assuming they have a choice :-).
You should allow your users to leave the control and validate what they have entered when they push ok or whatever is appropriate.
Michael
Jack White - 05 Mar 2007 12:55 GMT > IMO, you are going to a lot of trouble to make your app worse. Restricting > the user to a particular control when it is invalid is one of the worst [quoted text clipped - 4 lines] > You should allow your users to leave the control and validate what they > have entered when they push ok or whatever is appropriate. No, I disagree with that and so does MSFT (based on how their "Control.Validating()" model works). In my (long) experience, if a field contains invalid data then it should be trapped immediately unless it's either a cross-validation errror (i.e., the field itself contains valid data but it's invalid in conjunction with some other field), or it's a mandatory field that's currently blank but hasn't been filled in yet. These should be validated when OK is clicked (or in a grid control like "DataGridView", when the user attempts to leave the row itself opposed to the cell). All other validation errors should be trapped immediately since it makes no sense to allow a user to leave a field (or a cell) if its data is invalid. This is usually the ergonomically correct way of doing things and users wouldn't (and shouldn't) expect otherwise. Moreover, in my own case, I have an MDI child window which consists of one "DataGridView" control that consumes the entire window. Just about everything on my menus applies to that control so if the current cell is invalid, then almost all menu items are off-limits. Even if I did things the way you're suggesting, I would still need to treat these menu items as if the OK button was pressed, validating my control and preventing the user from exercising these items.
Michael C - 05 Mar 2007 23:05 GMT > No, I disagree with that and so does MSFT (based on how their > "Control.Validating()" model works). That's just plain wrong. MS rarely use the model you're describing in their software. I was going to save never but I did think of at least 1 obscure example. In the case when they do this (designing a query in MS Access), I find it annoying and it is definately unnecessary (why can't I just leave the field and fix it later?).
> In my (long) experience, if a field contains invalid data then it should > be trapped immediately unless it's either a cross-validation errror (i.e., [quoted text clipped - 5 lines] > trapped immediately since it makes no sense to allow a user to leave a > field (or a cell) if its data is invalid. What if they want to push cancel? What if they want to fill it in last? What if they want to copy-paste the result from another field? What if they just want to leave because they want to? There is absolutely no reason to force them to remain at that field. It's annoying and treats the user as an idiot.
What you say about leaving the row does make some sense assuming leaving the row acts as pushing ok. This is annoying also but as leaving a row is the same as pushing ok you need to validate then and there.
> This is usually the ergonomically correct way of doing things and users > wouldn't (and shouldn't) expect otherwise. It's extremely rare these days (to have the focus restricted to the field) and 99% of users would expect to be able to leave the field. Try watching some users use such an app, they most definately do expect otherwise. You can watch them try to leave the field, get suprised at the message, click ok, try to leave again, get annoyed, eventually enter false data and then push cancel.
> Moreover, in my own case, I have an MDI child window which consists of one > "DataGridView" control that consumes the entire window. Just about > everything on my menus applies to that control so if the current cell is > invalid, then almost all menu items are off-limits. Other areas of the app should assume the previous data until valid data is entered. Hence, nothing else should be off limits. This is fairly simple to implement because as the data has not been saved to the database, the database contains the previous data.
> Even if I did things the way you're suggesting, I would still need to > treat these menu items as if the OK button was pressed, validating my > control and preventing the user from exercising these items. No you wouldn't.
Michael
RobinS - 06 Mar 2007 00:37 GMT >> No, I disagree with that and so does MSFT (based on how their >> "Control.Validating()" model works). [quoted text clipped - 52 lines] > > Michael I'm going to throw my two cents' worth in and say that I agree with Michael. It would annoy me to no end, and I would toss the software out if I could. Think how you would feel if Visual Studio made you fix every error before letting you continue to the next word or statement.
For validation, I use the ErrorProvider control in combination with a self-written Validation class that I inherit for each entry form. As the user leaves the field, if it is wrong, it gets highlighted with an error icon. I don't let them save the data unless there are no errors (which I can check by checking the Count on my Validation class). If they try to move to the next record or something like that, they have to save or cancel their changes first. More code for me to write, but my users are much happier.
Robin S. Ts'i mahnu uterna ot twan ot geifur hingts uto. -------------------------------------------------------------
Otis Mukinfus - 06 Mar 2007 11:51 GMT >> IMO, you are going to a lot of trouble to make your app worse. Restricting >> the user to a particular control when it is invalid is one of the worst [quoted text clipped - 23 lines] >these menu items as if the OK button was pressed, validating my control and >preventing the user from exercising these items. I once worked for a manager who called your suggested method "Computer Tyranny".
I agree with Michael and Robin. If I ran into an application that behaved that way I'd be asking for a refund.
Good luck with your project,
Otis Mukinfus
http://www.otismukinfus.com http://www.arltex.com http://www.tomchilders.com http://www.n5ge.com
Jack White - 06 Mar 2007 22:14 GMT > I once worked for a manager who called your suggested method "Computer > Tyranny". Most managers don't know what they're talking about
> I agree with Michael and Robin. If I ran into an application that behaved > that > way I'd be asking for a refund. You might feel differently if you saw what I was developing. In any case, I didn't just hang a shingle outside my door yesterday and start programming. If I had the time I'd provide a laundary list of issues that you likely haven't considered but I'm sure everyone will still be attending the same church next week.
Michael C - 07 Mar 2007 04:15 GMT > Most managers don't know what they're talking about There's a name for what you've done there but I'm not sure what it is. It's the old "dogs have 4 legs, my table has 4 legs therefore it's a dog". Just because most managers don't know what they're talking about doesn't mean that all don't know or that even everything that a clueless manager says is wrong.
> You might feel differently if you saw what I was developing. In any case, > I didn't just hang a shingle outside my door yesterday and start > programming. I'm sure you know what you're doing but you're definately defending a technique that is largely discredited.
> If I had the time I'd provide a laundary list of issues that you likely > haven't considered but I'm sure everyone will still be attending the same > church next week. I'd be very interested to see this list. Certainly you've presented nothing compelling so far to support this technique.
Michael
Jack White - 07 Mar 2007 14:24 GMT >> If I had the time I'd provide a laundary list of issues that you likely >> haven't considered but I'm sure everyone will still be attending the same >> church next week. > > I'd be very interested to see this list. Certainly you've presented > nothing compelling so far to support this technique. That's because I didn't come here for that reason. To adequately explain the details including the nature of my own app (which you mischaraterized earlier) would take more keystrokes than I have the time for. Nevertheless, here's a short dissertation on the subject and I hope I'm not wasting my time. First, you seem to be hung up on the notion that users are going to be hopelessly locked into some field which will annoy them to the point that they're going to uninstall the program (a ridiculous assertion). Nobody's talking about locking people into fields unless the data is currently invalid. That doesn't mean they can't click the form's Cancel button nor press the Esc key to restore the field to its previous value. Nor does it mean that they can't use any menu item or hotkey so long as it's viable at the time. Nor does it mean that you lock them in if a field contains valid data but it fails cross-validation with one or more other fields (since users may need to correct the other field to fix the problem). What it does mean is they can't proceed to the next control on the form or use any impacted menu item (or hokey) until they correct the current control (provided that control is invalid but invalid in isolation). Why should users be surprised by this (contrary to your assertion). If the data is invalid then a message to that effect surprises no one. It's not unreasonable to ask them to fix it before moving on and they shouldn't be annoyed because the app is preventing them from inputting erroneous data. That's their fault. In fact, how does your own proposal save them from this "tyranniy" of four-legged tables that bark. It doesn't. It only defers the "annoyance" until later on. In fact, waiting until later is even more annoying if you're flooded with multiple errors (or even just one error) that should have been identified earlier. It's disruptive to the input process which naturally proceeds from control to control. If no error is displayed when you leave a field then you can safely assume it's correct and move on. This is the thinking pattern of most people in spite of your claims. When you look at the screen you instantly know that all fields contain valid data (assuming no cross-validation errors) except (possibly) the current field. The user's mental picture of what's going on is therefore clearer because the info they're looking at is error-free. This is especially true for data-input programs where users are entering large volumes of information and constantly checking things on screen. Nevertheless, for all users in general, it assists in your ability to input subsequent fields where decisions may be dependent on previous fields which you now know are in good working order. This is sound and ergonomically correct. Doing things the way you suggest only confuses users if they move through a bunch of fields without issue only to find problems when they eventually press OK. I'd be asking myself (and have many times) why it wasn't caught when I first entered it. I'd also be irritated (and have been many times) if I kept pressing OK after correcting an error only to find more errors (something that happens on a lot of web pages these days). Or to suddenly see my screen lit up with error indicators as someone else suggested (turning a simple error-handling process into a complicated one). Depending on the nature of the control that's in error, the type of form involved, and possibly timing issues (when and how the data was entered), you may even have to track down the original info again (to fix your errors - I've seen this) or re-enter other fields all over again, possibly throwing the entire form away itself (since the error may force you to re-evaluate what you've entered into other fields and possibly discard the entire form). If trapped immediately however then you wouldn't have these problems. It's also simpler and cleaner in code to trap errors as they happen rather than iterating through all controls at once later on. This approach isn't optimal for several reasons, not the least of which is that you typically wind up calling the same loop multiple times in the presence of multiple errors (where the user corrects only one error at a time before pressing OK again, causing you to start your loop all over). This causes you to validate controls that have already been validated.(potentially expensive but unecessary in any case) unless you plan on introducing overhead like a flag for each control (even if you set it at the time the field loses focus). You also have to store the error itself (assuming this isn't doubling for the flag) and possibly other info. Regerdless of what system you come up with, it usually means more overhead, more work, more code, more complexity, more (expensive) mainteance, more (potential) bugs and so on. Replicate this for many forms and compounds the problems. The issues run even deeper than what I've had the time to discuss so it's really a no-brainer as far as I'm conerned. It's also one that I've found most users do in fact prefer in spite of your contention. Lastly, in spite of some inconsistency in the framework for handling errors, MSFT nevertheless introduced "Control.Validating" and cousins for a reason (have you read this) so it's also more consistent with their own general approach regardless of what they do in their own apps (which is not always consistent either but they do in fact handle things both ways). The only point credible point I've actually heard from you is that people sometimes get stuck in a field that currently has invalid data. Yes it's annoying but it's also a trivial issue that's easily corrected by using the Esc key to back out. It's a tiny but necessary evil however (more of a minor nuisance really) and it hardly restricts navigation if handled correctly. It certainly doesn't trump the many reasons for it.
RobinS - 07 Mar 2007 18:31 GMT I guess we're going to have to agree to disagree. Because most people don't agree with you, and you're not going to change your mind.
> First, you seem to be hung up on the notion that users are going to be > hopelessly locked into some field which will annoy them to the point that > they're going to uninstall the program (a ridiculous assertion). This is not a ridiculous assertion. I wouldn't use a product that did this unless I was forced to by my management. The fact that *you* don't agree with this doesn't mean it's not true.
> It's not unreasonable to ask them to fix it before moving on and they > shouldn't be annoyed because the app is preventing them from inputting > erroneous data. That's their fault. ROFL. Not very user-friendly, are you?
By the way, I did a poll of 15 of my users, and they said if I implemented something like this, they would vote me off the island.
Robin S. -----------------------------------------
>>> If I had the time I'd provide a laundary list of issues that you likely >>> haven't considered but I'm sure everyone will still be attending the [quoted text clipped - 86 lines] > a minor nuisance really) and it hardly restricts navigation if handled > correctly. It certainly doesn't trump the many reasons for it. Michael C - 13 Mar 2007 03:56 GMT > That's because I didn't come here for that reason. To adequately explain > the details including the nature of my own app (which you mischaraterized [quoted text clipped - 79 lines] > restricts navigation if handled correctly. It certainly doesn't trump the > many reasons for it. You have still provided nothing special about your app that would show this approach is more suited than others (as you claimed to have). In answer to your other points
- "Users prefer your model". This is simply not true, users dislike your approach with a passion. The fact that others have replied the same here, saying they would uninstall such an app, shows that. It is not rediculous to think a user would uninstall, I have done it before, especially as this is a big problem when you're first getting to know the app. Your approach is also largely discreditted for good reason and has very little use these days.
- "It is more coding work". It is not, you need to validate at some time and it's pretty much the same amount of work. So does not lead to more bugs etc etc. You're stretching on this one quite a lot I think, I'd just validate multiple times and deal with it on the extremely rare chance it was expensive to do so. Generally when it's expensive it's better to do it all at once anyway to reduce database round trips (database lookups are likely to be the reason something is expensive). And if it is a database trip that is required then you have to do it when they push ok anyway because the data might have changed in the mean time. So even if you validate at the time of input you'll need to validate again anyway.
- "It is annoying for users to get multiple error messages when pushing ok." This is true but it is not a valid reason to go with your approach. Just give them all the errors in the ok message or show an indicator next to the field to indicate an error. Problem solved. This is pretty much the same as your approach but with the most annoying part of it removed. It has all the advantages of your method with none of the disadvantages.
- "You have only heard one valid point from me". Well, you are not listening. :-)
- "MS introduced Control.Validating for a reason". They introduce lots of features for a reason. That reason is they need to provide a fully featured language that caters to all tastes. They have provided other methods also, presumable for no reason :-)
Using some sort of indication next to the field and giving all the error messages when pushing ok would be the best approach imo.
Michael
Otis Mukinfus - 07 Mar 2007 13:01 GMT >> I once worked for a manager who called your suggested method "Computer >> Tyranny". > >Most managers don't know what they're talking about For the most part I agree with you, but this one did.
>> I agree with Michael and Robin. If I ran into an application that behaved >> that [quoted text clipped - 5 lines] >haven't considered but I'm sure everyone will still be attending the same >church next week. You've spent a lot of time arguing with people who gave you helpful opinions, so by all means, please give us the laundry list. Don't forget to include the times you had racing stripes in your shorts. You can flag those with an asterisk if you like.
Good luck with your project,
Otis Mukinfus
http://www.otismukinfus.com http://www.arltex.com http://www.tomchilders.com http://www.n5ge.com
md - 07 Mar 2007 13:10 GMT Since opinions were asked for, I thought I'd add my $0.02. I agree with everyone that said trapping someone in a field until it's what you want is a TERRIBLE idea. If I were doing an analysis of software for purchase and found it did this, that software would be instantly removed from my list. As mentioned, what if you want to cancel, or maybe you decided you don't want to enter the data now, maybe you need to do some more research on something, then you're trapped. BAD IDEA!
For what it's worth
Matt
>> I once worked for a manager who called your suggested method "Computer >> Tyranny". [quoted text clipped - 10 lines] > you likely haven't considered but I'm sure everyone will still be > attending the same church next week. Jack White - 07 Mar 2007 14:43 GMT > Since opinions were asked for, I thought I'd add my $0.02. I was really looking for a mechanical solution on how to handle this in .NET (if a mainstream way does in fact exist). I need to prevent users from selecting certain menu items for instance whenever the current control in my form is invalid. Simply disabling it until the control is valid again doesn't cut it since users may become confused as to why it's suddenly unavailable. The thread is now off-topic however.
Michael C - 13 Mar 2007 04:06 GMT > I was really looking for a mechanical solution on how to handle this in > .NET (if a mainstream way does in fact exist). I need to prevent users > from selecting certain menu items for instance whenever the current > control in my form is invalid. Simply disabling it until the control is > valid again doesn't cut it since users may become confused as to why it's > suddenly unavailable. The thread is now off-topic however. If you really want to go with your approach then you could do something like I did in visual basic 6 to implement security for my menus. I created a wrapper collection for the menus. When the app started this collection was populated by passing in a reference to each menu item. Additional information could be passed into the collection to be associated with each menu item. I could then iterate through the collection and hide/disable different menu items based on these flags. You could have a flag to indicate that the menu should be disabled during user input. If you don't want to disable the menu the you could check this flag in the menu's click event.
This is starting to get complicated though for no real benefit to the user, in fact it is a hassle to the user because if they are selecting that menu they wanted to go to that menu for a reason. More than likely the very reason is because of the error.
Michael
Mark Wilden - 07 Mar 2007 00:28 GMT > Is there a general approach for preventing users from selecting a menu > item in an SDI or MDI application whenever the current field on your form > is invalid 1) Please use a meaningful subject line.
2) Please do not spam multiple groups.
3) Please do not post non-C# messages to a C# newsgroup.
Thanks,
///ark
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|