Jump to content

Key Focus Bug or Feature?


viSci

Recommended Posts

Lets say you have a numeric control set to the value of 1. If you set the key focus you will see that the text field in the control becomes hightlighted.

If you repeatedly press the up arrow on the control you will notice the value incrementing 1,2,3..8,9,10, and then jump to 20,30,40 etc.

If you use the up arrow on the keyboard then it will increment by one throughout the range. I am inclined to consider the nonuniform incrementing to be a bug since

in my case it is undesirable and even hazardous since it can cause a system control value (gas pressure for example) to unexpectedly jump up in value.

The solution I found is to use the NumText.SelStart and End properties to force the whole numeric field to remain selected and then the value will increment uniformly.

Link to comment

Lets say you have a numeric control set to the value of 1. If you set the key focus you will see that the text field in the control becomes hightlighted.

If you repeatedly press the up arrow on the control you will notice the value incrementing 1,2,3..8,9,10, and then jump to 20,30,40 etc.

If you use the up arrow on the keyboard then it will increment by one throughout the range. I am inclined to consider the nonuniform incrementing to be a bug since

in my case it is undesirable and even hazardous since it can cause a system control value (gas pressure for example) to unexpectedly jump up in value.

The solution I found is to use the NumText.SelStart and End properties to force the whole numeric field to remain selected and then the value will increment uniformly.

Curiously enough, there was a debate just last week within R&D about whether this was a bug or not. There was no agreement, and those responsible for the differences are no longer around. You should be aware of the following arrow key behavior: It increments whichever digit the cursor is next to. So if your cursor is next to the tens digit, you'll increment by 10. Next to the hundreds digit, you'll increment by 100. In that respect, it is more flexible than the increment arrows. Desired behavior? I don't know. I found it because I changed the increment setting of the numeric to increment by 2, and yet the up arrow still incremented by one. The arrow keys are unaffected by the increment defined for the numeric.

The behavior is what it is, and I doubt it will change because someone might want it. But I think (hope) you can build an XControl that intercepts the up and down arrow keys and applies different behavior.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.