Skip to main content
Participant
March 26, 2009
Question

Adding Display Object (ComboBox, DataGrid) to Text Layout

  • March 26, 2009
  • 2 replies
  • 2331 views
Is there any way of adding custom components or a simple datagrid into the text editor. like we can add images

This topic has been closed for replies.

2 replies

Participant
May 29, 2009

Actually i have tried adding multiple textflows in a single VBOX using UIcomponent along with display objects such as datagrid , combobox ect and i was able to achieve success.

Regards

Varun Rathore

http://www.vrathore.blogspot.com

Participant
June 9, 2009

Hi,

It would be a great great help to get an example. Even with snippets found in blogs, I can't figure out how to add a ComboBox (for my own need) in the TextFlow and keep interactivity with that added comp.

Thanks !

June 12, 2009

I posted another post here asking the exact same thing, only with static (read-only) text. I'm using a TextBlock for that and TextLines made of TextElements and GroupElements. I want to be able to implant comboboxes and other display objects within the text (for example, a text element, another text element, then my display object, then more textelements.. etc)

Any ideas?

March 26, 2009
i think you can try to add component to InlineGraphicElement. Then set its size to match your component's size. You can also add component to textline but you will need to do positioning manually.
March 26, 2009
To display Flex components that descend from UIComponent as the source of an InlineGraphicElement, I had success by creating a wrapper for the flex component(s) that extends Sprite or something close to Sprite and then provide the 'hookups' that UIComponent usually provides for children that get added. It doesn't take too long to identify what you need to do if you dig into the source code for UIComponent in the Flex Framework SDK.

Even though I was successful in being able to display the flex component, it was very difficult to tie other things to the flex objects since they're buried in the TextLine's. Other tough things to handle included measurement and sizing of the flex components, preventing TLF from handling keyboard/mouse events when your flex component is focused, and resizing of the InlineGraphicElements when the flex component is resized. Also, I ran into some issues when I tried to render a really big flex component in a text line. Didn't typically see problems with sizes until something over 1000 pixels tall.

There are other ways, but I wouldn't say there's a quick way to do stuff like this. You're a lot better off if you start thinking about how you can put TLF into (or underneath) your stuff instead of trying to get yours into it. Also, if you want to position things relative to text, there's some good examples out there that show how to look up positions of the text lines.

Hope this helps!

--Brent