Although my question is regarding functionality in a grid I believe the answer relates more to editors why this post is here instead of in the grid category.
I'm creating an UltraGrid with a column that should have a text editing behavior similar to the style of the To, Cc and Bcc fields of a new Outlook message. See picture.
The behavior should be such as the following:
A cell should be able to hold a mix of* "objects" of marked text – such as underlined addressees in Outlook* characters – any regular character
If you click on an "object" the whole object should be marked – it should graphically (and logically) work as an entity – while clicking among characters should behave as any standard text editor in terms of marking and editing.If you right-click an "object" there should be a context menu applicable to the "object".You should be able to drag-and-drop an "object" among the characters and "objects" within the cell or to another cell in the column. Also you should be able to drag-and-drop any selection (including any combination of "objects" and characters).There should be a relevant mechanisms for handling of the data in the cells – characters and “objects” and their ordering – where the "objects" should be linked/references to items of a datatable or similar.
(The idea is to use this feature to define display layouts. The objects are placeholders of data – such as a figure with a unit.)
I've searched through the Infragistics components the best I could and haven't found any leads among them regarding the support of such functionality, why I have the following questions:
1. Is the described functionality or something similar readily available with the Infragistics components?
2. Or will I have to implement all of this myself?
3. If so, what is a suggested best approach to implement such functionality in the UltraGrid?
4. (Or is there perhaps another standard data display layout defining approach that our designers haven’t thought about?...)
I'm guessing I will have to implement it all myself, and I figure I'll need to use an embeddable editor for the grid column. Which? Plain UltraTextEditor?
Then, is there some Infragistics (or other for that matter) editor text parsing mechanism that I should use? (Using regular expressions perhaps?)
Is there implementation code of standard drag-and-drop and text editing behavior available somewhere? (Trying to cut some corners...)
Are there Infragistics component mechanisms that I should utilize? EditorDataFilter? How?
Thanks in advance for any advice!
-Ulf
There's no built-in functionality like this in NetAdvantage right now. But this would be a great suggestion for a feature in a future release of NetAdvantage.
Submit a feature request to Infragistics
This looks like a pretty complicated thing to implement yourself and without actually doing it, I couldn't say for sure that it's even possible. There are probably some pitfalls here regarding text selection that you might not be able to account for.
If I were going to code this, I'd probably begin by using Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor, which is the editor that the UltraFormattedTextEditor uses. The underlined entities here could be thought of as hyperlinks. And then you would have to deal with keyboard behavior, either by deriving from the editor and handling it's OnKeyXXX methods or handling these on the grid using the key events.
Thank you very much for your reply!
It's good to have settled that I won't find the feature among the NetAdvantage/Infragistics controls.
I looked at implementing this myself:
Regarding marking of the "objects" I could do with using brackets such as [object1] instead of underlining them.
I tried using the UltraTextEditor and deriving events (such as MouseDown, MouseUp, Click, DoubleClick) from the underlying editor to handle the marking of whole "objects" when clicking on them and this worked fine. Problem arises (at least) when the user wants to mark more than just characters or just one "object", such as a combination of them, with the use of the mouse since there is no SelectionChanged event for the Infragistics editors or the underlying .Net TextBox. (I sure would appreciate a SelectionChanged event...)
I shortly looked into using the MouseMove event but it does not seem like a good way. Or am I wrong?
(Also, using a timer while the mouse button is down and tracking the movements and selections, seems like an ugly [or impossible] way that I don't want to go down.)
Since the .Net RichTextEditor has the SelectionChanged event I'm now wondering if there is a way to embed such a control into the UltraGrid?
Thanks again,