Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
UltraTextEditor not losing focus
posted

I have seen a few topics related to this, but not sure if the issue is resolved, or exactly the same as my case.

I have an UltraTextEditor on my win form, once data is entered and tab is pressed I want the focus to either move to the next control, or some other control based off certain conditions.

I am currently consuming the AfterExitEditMode event to:

1) look up information based on the value of the UltraTextEditor control. If certain criteria is met, the next control (An UltraComboEditor control) is set to a specific SelectedIndex and focust should then be set to another UltraTextEditor control on the page.

2) if the value in the UltaTextEditor does NOT meet specific criteria, I want the focus to be on the UltraComboEditor control bypassed in 1).

Right now, if I enter a value in the UltraTextEditor and press tab, my code tries to set the focus to the correct control, but after the AfterExitEditMode event is done firing, the focus moves back to the UltraTextEditor control and the value is highlighted.

This control is NOT databound.

What am I missing?

  • 37774
    Verified Answer
    posted

    The reason that this is happening is that the UltraTextEditor is calling the ProcessDialogKey method so that any listeners (i.e. the form) can take the appropriate action, which is what causes the tab navigation to work in the first place.  Since this method is called after the AfterExitEditMode event is fired, your best bet is to override the ProcessDialogKey method on the form (or possibly on a derived UltraTextEditor) and to manually set focus to the appropriate control; if you do this, you probably need to return True from the method to indicate that you handled the processing.

    -Matt