Solve the problem that the dotnetbar Textbox Control loses focus after pressing enter.

Source: Internet
Author: User

The Textbox Control provided by dotnetbar modifies the default behavior. When you press enter, the focus will jump to other controls, and CTRL + enter will be the default behavior. Sometimes this function is not required for an input box on the interface. For example, for a textbox with multiple rows, you need to enter another line, and the focus is still on the textbox.

To solve this problem, you must first set the textbox's acceptenter to true, but setting this attribute only does not work. You also need to respond to the keydown event of textbox. When the keycode is enter, set handle to true and set supresskeydownevent to true.

Sometimes this method does not work. Dotnetbar has a textboxitem control. This method does not work even if the textbox control encapsulated by it responds to events. Another way is to start a timer (or a new thread) in response to the keydown event, and set the timer time to be particularly short, for example, 50 milliseconds, set the focus back to textbox in the response function.

Personal Homepage synchronously updated

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.