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
665
SupportsSelectableText for UltraControlContainerEditor
posted

I use the UltraControlContainerEditor to allow the of a specialised text box when editing a particular column in a UltraGrid. The specialised text box is inherited from UltraTextEditor.

When the user enters any cell I want the text to be highlighted. To achieve this I have always used:

private void grid_AfterEnterEditMode(object sender, System.EventArgs e)
{
        Infragistics.Win.EmbeddableEditorBase editor = this.gridQty.ActiveCell.EditorResolved;

            if (editor.SupportsSelectableText)
            {
                editor.SelectionStart = 0;
                editor.SelectionLength = editor.TextLength;
            }

The issue I face is that SupportsSelectableText is always false for my custom control. I have tried adding a SupportsSelectableText property to the control but this doesn't help.

Is there a way to make my custom control work with the AfterEnterEditMode code above?

Many Thanks
Paul

  • 469350
    Offline posted

    Hi Paul,

    The UltraControlContainerEditor cannot support selectable text because it has no way of knowing whether the EditingControl you are using supports selection or how to select text within it.

    If you really want to work at it, you could probably make this work by deriving your own editor from the ControlContainerEditor class. That's the actual editor class, not the component like UltraControlContainerEditor. You could override SupportsSelectableText and then handle the SelectionStart and SelectionLength properties yourself by delegating them off to the UltraTextEditor.

    But I think this is probably more trouble that it's worth. It depends what you are trying to do, but Boris's solution might be easier.

  • 71886
    Suggested Answer
    Offline posted

    Hello Paul,

    I am wondering about a few things here. First, why do you take the way with the UltraControlContainerEditor component and not just assign the TextEditor as an EditorComponent of the column?

    Why are you trying to select the text like this? You could simply use

    ultraTextEditor1.SelectionStart = 0;
    ultraTextEditor1.SelectionLength = ultraTextEditor1.TextLength;

    Also, the editor object you are using would return the UltraControlContainerEditor component and not the text editor.

    I am starting to feel that I do not understand your scenario, so please take a look at my sample and let me know what you think about it.

    TextEditorSelection.zip