删除只读到休假的下一个字段,然后输入

时间:2019-05-27 14:46:09

标签: c#

在我的应用程序中,有些字段是只读的,这取决于其他字段的值。

对于其Enter事件中的每个组件,如果该组件都是只读的,则我调用Form.SelectNextControl来激活下一个组件,因此我只能关注已启用的组件。

在某些组件上,在Leave事件中,如果其值正确,我会将其他组件设置为非只读。

# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility

import re

regex = r"(?:lat=)([0-9\.\-]+)(?:,)"

test_str = "Feature(place='28km S of Cliza, Bolivia', long=-65.8913, lat=-17.8571, depth=358.34, mag=6.3) Feature(place='12km SSE of Volcano, Hawaii', long=-155.2005, lat=19.3258333, depth=6.97, mag=5.54)"

matches = re.finditer(regex, test_str, re.MULTILINE)

for matchNum, match in enumerate(matches, start=1):

    print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))

    for groupNum in range(0, len(match.groups())):
        groupNum = groupNum + 1

        print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))

# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.

我遇到的问题是,如果我将ReadOnly设置为false(txtSubCategory)的组件是下一个组件,则好像ReadOnly设置为false之前就触发了Enter事件,并且由于Form.SelectNextControl而被跳过。 / p>

我虽然修改了离开事件,所以如果将只读设置为false,则会将焦点设置为该组件,但是如果用鼠标触发了离开,则我不想将其聚焦。

什么是可能的解决方案?

0 个答案:

没有答案