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
925
Formatted Text Editor Enter Edit Mode when in DropDownEditorButton
posted

I have a fairly involved scenario:

An UltraGrid with a column using a FormattedTextEditor as the EditorComponent that has a DropDownEditorButton in its RightButtons.

This button is linked to an UltraPanel that contains another FormattedTextEditor amongst other things. What I want to happen is that when the user clicks the DropDownEditorButton the 2nd FormattedTextEditor is automatically given focus in edit mode so the user can start typing straight away.

I've tried all sorts of combinations of :

DropDownEditorButton.Autofocus

Setting FormattedEditor.Focus in various events

Am I missing the right combination of settings?

  • 69832
    Verified Answer
    Offline posted

    The way the AutoFocus property works is it will focus the control assigned to the DropDownEditorButton.Control property, which it seems in your case is an UltraPanel. That in and of itslef will not focus the FormattedTextEditor.

    You didn't mention in which events you tried focusing the FormattedTextEditor, but my guess is this is a timing issue; at the time the UltraPanel is focused, the FormattedTextEditor might not yet be in a state where it can receive focus (i.e., it isn't visible yet). if this is the case, one thing you could try is to call the FormattedTextEditor.Select method asynchronously (see BeginInvoke method) from the UltraPanel's Enter event. This will post a WM_FOCUS message rather than send it immediately, so that it won't be processed until after the method that causes the UltraPanel's Enter event to be called has completely finished executing.

    If you like you can attach a sample here and we can take a look.