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
425
Renaming a cell item in outlook express mode
posted

Hi,

How can i make a cell editable on paused mouse left click (first click makes node selectable and after some 2 secs selecting the same node makes it editable) and also by the selection of F2 key.  It works fine if i have added nodes as UltraTreeNodes to tree but if i have added Nodes as cells and using Node.SetCellValue for passing the text, F2 key and Paused Mouseleftclick are not working properly.

Regards,

Sriram Sarma.

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    F2 editing is supported intrinsically; the UltraTree.ColumnSettings.AllowCellEdit property has to be explicitly set to allow it. Given the "Paused Mouseleftclick" functionality you described, you should also set the UltraTree.Override.CellClickAction property to 'SelectNodeOnly'. Then, in response to the AfterSelect event, get the cell at the cursor position using the following approach:

    private UltraTreeNodeCell CellFromPoint( UltraTree tree, Point point )
    {
        UIElement controlElement = tree != null ? tree.UIElement : null;
        UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;

        while ( elementAtPoint != null )
        {
            UltraTreeNodeCellUIElement cellElement = elementAtPoint as UltraTreeNodeCellUIElement;

            if ( cellElement != null )
                return cellElement.Cell;

            elementAtPoint = elementAtPoint.Parent;
        }

        return null;
    }

    You could then do something like start a timer when the mouse comes down on that node again, and when the timer expires, call the UltraTree.ActiveCell.BeginEdit method to enter edit mode on the cell that was clicked previously.

Children
No Data