Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Dynamically expand Textarea on a Shape node (Read 3034 times)
mjweyland
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: Apr 2nd, 2007
Dynamically expand Textarea on a Shape node
Oct 23rd, 2009 at 12:22am
Print Post  
I have a custom shape node that I'm using with a flowchart solutionl.  WE'd like to change the height of the Text area when it exceeds the initial height definition.   Any suggestions?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Dynamically expand Textarea on a Shape node
Reply #1 - Oct 23rd, 2009 at 5:52am
Print Post  
Set the Shape.TextArea property, and assign the Shape object back to ShapeNode.Shape.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mjweyland
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: Apr 2nd, 2007
Re: Dynamically expand Textarea on a Shape node
Reply #2 - Oct 23rd, 2009 at 1:18pm
Print Post  
I'm already setting the shape node's text area in that fasion. The problem is that the initial size definition isn't always sufficient. So, if the text is longer than the given region it doesn't display then entire text.

So, in my code I create a custom shape node, that consumes a custom defined shape.  For that shape I define the text area as follows.

Code
Select All
_s.TextArea = New ElementTemplate() {New LineTemplate(0, 70, 100, 70), _
                                                 New LineTemplate(100, 70, 100, 100), _
                                                 New LineTemplate(100, 100, 0, 100), _
                                                 New LineTemplate(0, 100, 0, 70)} 



Then in the ShapeNode code definitions:
ShapeNode.ResizeToFitText(FitSize.KeepWidth)

The overall height of the node doesn't seem to change with respect to the amount of text defined for that particular shape node.

How would I change the height of this region dynamically?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Dynamically expand Textarea on a Shape node
Reply #3 - Oct 23rd, 2009 at 1:43pm
Print Post  
Are you trying to resize the text area without resizing the node? Try to create a temporary Rectangle node with the same width, text and font attributes, call its ResizeToFitText(keepWidth) method, and calculate the new text area size from the temp node size.
  
Back to top
 
IP Logged
 
mjweyland
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: Apr 2nd, 2007
Re: Dynamically expand Textarea on a Shape node
Reply #4 - Oct 23rd, 2009 at 1:50pm
Print Post  
Im trying to resize the text area without resizing the image area of a shape node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Dynamically expand Textarea on a Shape node
Reply #5 - Oct 26th, 2009 at 8:01am
Print Post  
Since both are specified as percents of the node size, you'll have to do some math. E.g. if you are splitting nodes vertically, you need only to find the height and it should look like this:

node.Resize(node.Bounds.Width, requiredImageHeight + calculatedTextHeight + margin);
float imageHeightPercents = 100 * requiredImageHeight / node.Bounds.Height;
float textHeightPercent = 100 * calculatedTextHeight / node.Bounds.Height;
//create a new Shape and assign it to the node

I suppose in this case it would be easier if the nodes had their own image and text area properties; I'll add this as a feature request in our todo list. You might also consider using TableNodes with two cells, one for the image and one for the text.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint