AutoResizes for GoText in GoMultiTextNode


#1

I am using the demo 1 sample, to try to understand GoText AutoResizes within a GoMultiTextNode

I run demo1, add a RecordNode and select it. I then use the property
panel to select and change the following properties of one of the
GoText objects with the RecordNode:

AutoResizes : true

Selectable : true

MultiLine : false

ResizesRealtime : true

AutoRescales : true

Text : the quick brown fox jumped over the lazy dog

Clipping : False

Editable : true

Resizable : true

But, the width of the GoText does not change. (Either in the diagram, or in the property panel)

Because Clipping is false, I can see the text extending beyond the
bounds of the GoText. Of course, I really want the GoText bounds to
grow to accomodate the changed text

Why isn’t the GoText width increasing? Is it because the GoText is constrained by its parent, the GoMultiTextNode?

How do I get the GoText and GoMultiTextNode to Resize to accomodate the changed text?

If I have to set the width of the GoMultiTextNode, is there a way to calculate the size of the text ?

thanks,

Pete


#2

That’s governed by the GoMultiTextNode.ItemWidth property.


#3

I know, but to set the ItemWidth property I need to get the desired
width of the GoTexts. I cannot set the ItemWidth of the GoMultiTextNode
to the actual width of the GoText objects because the GoTextObjects
cannot expand because they are constrained by the ItemWidth.

I have 2 workarounds:

  1. I guess I could set the ItemWidth to some very high value, change
    the text of the GoTexts, and the GoText widths would increase now the
    ItemWidth was not constraining them. Then I could reset the ItemWidth
    to match the width of the widest GoText.

  2. This is the workaround I am currently using : I have a singleton
    dummy GoText that is not within a GoMultiTextNode. I set the text of
    the dummy GoText , and then get the Width of the dummy. In other words,
    I use a dummy GoText just to calculate the required width of the
    GoText. Then I set the ItemWidth using that calculated value.
    This works, but seems a bit of a hack.


#4

Sounds good enough.
The ideal thing to do would be to subclass the GoListGroup that is inside the GoMultiTextNode, so that LayoutChildren would recognize when a GoText got wider or narrower, and adjusted the ItemWidth accordingly.
But that GoListGroup in GoMultiTextNode isn’t publically accessible. Maybe we should make such functionality available someday.