Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TextArea in ShapeNode (Read 2927 times)
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
TextArea in ShapeNode
Jan 17th, 2010 at 7:34am
Print Post  
Hi Stoyo, one more question about ShapeNode.
I need that a text would be aligned below the shape in any case and if it's possible the text would be displayed without the trimming and an initial shape size wouldn't be changed.

I've tried several variants:
- resizing a textarea in the shape but I couldn't do it without changing shape size
- using empty textarea and setting LineAlignment property to Far - I've got the text over the shape

Now I think to combine a shapenode with text in ContainerNode but may be you could suggest another way?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TextArea in ShapeNode
Reply #1 - Jan 17th, 2010 at 12:13pm
Print Post  
Hi,

You could set the shapes text area to a very large rectangle starting from Y = 100:

Code
Select All
foreach (Shape shape in Shape.Shapes)
{
	shape.TextArea = new ElementTemplate[]
	{
		new LineTemplate(-1000, 100, 1100, 100),
		new LineTemplate(1100, 100, 1100, 1000),
		new LineTemplate(1100, 1000, -1000, 1000),
		new LineTemplate(-1000, 1000, -1000, 100)
	};
} 



Now if you set TextFormat to be top-aligned and horizontally-centered, the nodes should be able to display very long texts without trimming.

Some other options are:

- inherit from ShapeNode and override its Draw and GetRepaintRect methods to draw text below the node's shape.

- create a separate ShapeNode to display the label, place it below the main node, and call labelNode.AttachTo(mainNode, AttachToNode.BottomLeft)

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


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: TextArea in ShapeNode
Reply #2 - Jan 19th, 2010 at 5:54am
Print Post  
Hi, Stoyan!
I've tried the first option and text isn't being displayed at all. May be I do smth wrong. Could you provide some more code? What does it mean "TextFormat to be top-aligned"?

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TextArea in ShapeNode
Reply #3 - Jan 19th, 2010 at 8:28am
Print Post  
Hi Alex,

Set the TextFormat's LineAlignment to Near, or the text would be displayed far below the shape.

Stoyan
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: TextArea in ShapeNode
Reply #4 - Jan 19th, 2010 at 11:12am
Print Post  
I did it, now I see the text, but just after creation the text is not fully displayed, I guess it's cliiped by some region. If I remove the focus from the view, the view will be repainted and the text will be displayed well. May be I should force repaint by myself?
« Last Edit: Jan 19th, 2010 at 12:12pm by shalex »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TextArea in ShapeNode
Reply #5 - Jan 19th, 2010 at 12:12pm
Print Post  
Hi,

Ok, currently this will repaint correctly only if you define the text area through a Shape constructor, instead of setting it through the property. There's some repaint area flag that the constructor sets and the property does not. We'll fix the property setter in the next few days.

Stoyan
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: TextArea in ShapeNode
Reply #6 - Jan 20th, 2010 at 6:28am
Print Post  
Thank you, Stoyan. I tried to recreate Shape with a new text area before the setting to a SHapeNode and it works.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint