意见通缉 [英] Opinion wanted

查看:79
本文介绍了意见通缉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


是否有一般方法阻止用户在当前字段中选择SDI或MDI应用程序中的菜单项

您的表单是

无效(假设该应用程序包含数据输入表单)。在我的情况下,我是使用DataGridView工作的
。它占据了

MDI应用程序的整个子窗口,但问题可能适用于任何控件。如果您已将

无效数据输入到TextBox中例如一个表单的字段(在我的情况下是一个

网格单元格),它可能是菜单中的大多数(如果不是全部)项目以及

大多数热键应该是禁止的,直到用户纠正该字段。没有

非常痛苦地阻止用户访问这些项目

然而(这并不总是微不足道),是否有更简单的方法。谢谢。

解决方案

我使用的技术是在控件上设置Enabled或Visible

错误。


另一种技术是显示一个包含输入字段的Dialog,当

时,主窗体上的错误无法通过审计。对话框是模态的,这意味着

用户必须输入数据并在任何其他控件可以访问
之前关闭对话框。您通过(重新)审核数据并重新显示对话框来处理对话框,如果它仍然不正确。另外你接受它就好像在主窗体上输入了

,然后继续处理表单的'其他

输入字段(以相同的方式) 。


" Jack White" < no_spam@_nospam.com写在留言中

新闻:Oc **************** @ TK2MSFTNGP06.phx.gbl ...
< blockquote class =post_quotes>
你好,


是否有一般方法阻止用户在SDI中选择菜单

项目当表单上的当前字段无效时(或者应用程序包含数据输入表单),或者MDI应用程序。就我而言,

我正在使用DataGridView。占用整个子窗口

的MDI应用程序,但问题可能适用于任何控件。如果您已将
输入无效数据到TextBox中例如一个表单的字段(在我的

情况下是网格单元格),菜单中的大多数(如果不是全部)项目可能与大多数热键一样好。应该是禁止的,直到用户更正

字段。没有用很大的痛苦阻止用户访问这些项目(但这并不总是微不足道),是否有更简单的方法。谢谢。



感谢您的反馈。


我使用的技术是在控件上设置启用或

可见为假。



我发现处理其他控件很容易,因为你可以简单地阻止

用户离开无效控件直到它有效。通常有

自定义事件或覆盖可以帮助解决此问题,通常是

" Control.OnValidating()"和Control.OnValidated()。问题是

他们不会阻止用户访问菜单本身或任何热键。对于

,我发现需要进行大量的重新布线才能使一切正常工作,即使只是因为它只是禁用它而导致
(由于其他问题我不会进入这里)。它是

不是一个平滑的过程。


另一种技术是显示一个Dialog,其中包含一个输入字段,当

主窗体上的错误未通过审核。对话框是模态的,意思是

用户必须输入数据并在可以访问任何其他

控件之前关闭对话框。您通过(重新)审核数据来处理对话框

并重新显示对话框(如果它仍然不正确)。另外你接受它

就好像它是在主窗体上输入的那样,然后继续

处理表单的其他输入字段(以相同的方式) 。



这实际上并不是一个坏主意(对于某些控件而言)但是我想知道

如果用户会发现它有点笨拙。也许我可以将字段停靠在

对话框中,然后在原始字段上叠加whoe的东西,这样用户就不会注意到任何事情。这种类型的可重复使用控件对于这个目的很有用,但它仍然是非正统的。您还必须将

集中处理该字段的逻辑,以便现在可以从原始的

表单和对话框中调用它。我会多考虑一下,但我必须相信

这是一种更为主流的处理这种情况的方法。谢谢

再次(赞赏)。


3月2日下午6:23,Jack White < no_spam@_nospam.comwrote:


你好,


是否有一般方法阻止用户选择菜单项

在SDI或MDI应用程序中,只要表单上的当前字段为

无效(假设应用程序包含数据输入表单)。在我的情况下,我是使用DataGridView工作的
。它占据了

MDI应用程序的整个子窗口,但问题可能适用于任何控件。如果您已将

无效数据输入到TextBox中例如一个表单的字段(在我的情况下是一个

网格单元格),它可能是菜单中的大多数(如果不是全部)项目以及

大多数热键应该是禁止的,直到用户纠正该字段。没有

非常痛苦地阻止用户访问这些项目

然而(这并不总是微不足道),是否有更简单的方法。谢谢。



杰克:


您是在询问如何验证用户数据,或者如何采取行动

验证是否已经处理?


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.

解决方案

The technique I use is to set, on the control(s), either Enabled or Visible
to false.

Another technique is to show a Dialog, which contains an input field, when
the error on the main form fails an audit. The Dialog is modal, meaning the
user must enter the data and dismiss the dialog before any other control can
be accessed. You process the Dialog by (re)auditing the data and reshowing
the Dialog if it is still incorrect. Else you accept it just as if it was
entered on the main form, and then continue with processing the form''s other
input fields (in the same way).

"Jack White" <no_spam@_nospam.comwrote in message
news:Oc****************@TK2MSFTNGP06.phx.gbl...

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.



Thanks for the feedback.

The technique I use is to set, on the control(s), either Enabled or
Visible to false.

I find handling other controls easy enough because you can simply prevent
users from leaving the invalid control until it''s valid. There are normally
custom events or overrides that assist with this, typically
"Control.OnValidating()" and "Control.OnValidated()". The problem is that
they don''t prevent users from accessing the menu itself nor any hotkeys. For
that I''m finding a lot of re-wiring required to make everything work, even
if it''s just disabling it (due to other issues I won''t get into here). It''s
not a smooth process.

Another technique is to show a Dialog, which contains an input field, when
the error on the main form fails an audit. The Dialog is modal, meaning
the user must enter the data and dismiss the dialog before any other
control can be accessed. You process the Dialog by (re)auditing the data
and reshowing the Dialog if it is still incorrect. Else you accept it
just as if it was entered on the main form, and then continue with
processing the form''s other input fields (in the same way).

That''s not a bad idea actually (for some controls anyway) but I''m wondering
if users would find it a little unwieldy. Maybe I can dock the field to the
dialog and then superimpose the whoe thing on the original field so the user
won''t notice anything. A reusable control of this type would be useful for
this purpose but it''s still unorthodox. You would also have to centralize
the logic for handling the field so it can now be called from the original
form and the dialog. I''ll give it some more thought but I have to believe
there''s a more mainstream way of handling this situation in general. Thanks
again though (appreciated).


On Mar 2, 6:23 pm, "Jack White" <no_spam@_nospam.comwrote:

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.

Jack:

Are you asking how to validate the users data, or how to act once
validation has been processed?


这篇关于意见通缉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆