When a text is pasted into the UltraTextEditor, I would like to preprocess that - look into the clipboard contents for specific stuff and then decide on the contents to be pasted. With normal windows forms textbox, I can override WndProc method, process the WM_PASTE (0x302) message. But with the UltraTextEditor I'm not getting the message - 0x302. Is there any way I can achieve this?
Hi,
When an UltraTextEditor control goes into edit mode, it displays a derived TextBox control over itself to allow the user to edit. So what I would recommend is that you use the ControlAdded and ControlRemoved events to trap this TextBox control and then you can do what you want with it.
Another option would be to use the KeyDown event.
Hi Mike,
Thanks for the reply. Even if I manage to get the reference to the TextBox used by the UltraTextEditor, how would I trap the 'Paste' message destined to that TextBox unless it is a custom one written by myself?
With KeyDown event, we can trap the 'Control+V' key press but how would I trap the paste initiated by right clicking on the textbox's context menu?
I'm not an expert in the windows programming, so please correct me if I didn't get your point.
Arun
Hi Arun,
No, I think you're right, I didn't think it through to that point.
I don't see any way you can reasonably trap this message in am UltraTextEditor. You can submit the issue to Infragistics as a feature request - perhaps an event like BeforePaste could be added to the control.
Request a Feature or Component
Any update on this?
I also have the same requirement to preprocess the pasted text.
Can you please let me know any work around for this?
Thanks,
Satish
I don't know of any immediate plans to implement such an event. You can Submit a feature request to Infragistics.
Mike thanks for clarifying this, how about my main question, are you planing to introduce BeforePaste?
K
The property is virtual because we, internally, use a different textbox class based on whether or not we have full trust. There are certain things we cannot do in a partial trust environment. It's not intended for you to replace the TextBox with your own control.
Hi
Have you implemented this in the end? I'm having the same problem and cannot find easy solution to this.
I was thinking I could create my own implementation but textBox is private so I can not create my own editor at this point, even if I override TextBox property - this is actually stange as if textBox is private it doesn't make sense to have TextBox property virtual as if you change it and not use textBox filed this class will be in invalid state as other functions are using textBox field.
This is EditorWithText class.
public virtual EmbeddableTextBox TextBox{ get { if ((this.textBox == null) && !base.Disposed) { try { new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert(); this.CreateEmbeddableTextBoxWithUIPermissions(); } catch { this.textBox = new EmbeddableTextBox(this); } this.textBox.Location = new Point(-10000, -10000); } return this.textBox; }}