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
160
SelectedText
posted

Is there a way to get the SelectedText of a Node when it is being edited?  I am not using a custom editor just the default.  I have a cut/copy/paste menu that I want to be aware of the node in edit mode and respond properly.

  • 69832
    Offline posted

    If you were using embeddable editors you could just use the SelectionStart/SelectionLength properties of the editor. In your case you could handle UltraTree's ControlAdded event, and hook the TextChanged event of theTextBox that gets added as the default editor.

    I think the wrinkle here is that the TextBox class does not fire an event when the text selection changes, nor when the context menu is shown. You can of course handle the windows messages like EM_SETSEL, but then you are in the unmanaged code realm. If you already have a trigger by which to get the text selection, the above method will work.