Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ShapeNode Null reference when specifying both OutlineFormula and Text Area (Read 1612 times)
rdwheeler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: May 28th, 2008
ShapeNode Null reference when specifying both OutlineFormula and Text Area
Feb 3rd, 2020 at 6:33pm
Print Post  
In Diagramming.WinForms 6.6, I am encountering a null ref error (attached) when I specify both OutlineFormula and TextArea properties of ShapeNode.

                 _baseLabelArea = new ElementTemplate[]
                 {
                       new LineTemplate(10, 10, 90, 10),
                       new LineTemplate(90, 10, 90, 90),
                       new LineTemplate(90, 90, 10, 90),
                       new LineTemplate(10, 90, 10, 10)
                 };

                 string script = $@"
                       apOffset = {PART_ATTACH_POINT_OFFSET};
                       apDepth = {PART_ATTACH_POINT_DEPTH};
                       bump = 2;
                       apLong = (Height) - (apOffset * 2);
                       vapOffset = apLong + (apOffset * 2);
                       MoveTo(apOffset, 0);
                       ArcTo(0, apOffset - bump, false, true, apOffset, apOffset);
                       LineTo(0, apOffset);
                       LineTo(1, apOffset);
                       LineTo(apDepth + 1, Height / 2);
                       LineTo(1, Height - apOffset);
                       LineTo(0, Height - apOffset);
                       LineTo(0, Height - apOffset + bump);
                       ArcTo(apOffset, Height, false, true, apOffset, apOffset);
                       LineTo(Width - vapOffset, Height);
                       LineTo(Width - vapOffset + (apLong / 2), Height + apDepth);
                       LineTo(Width - vapOffset + apLong, Height);
                       LineTo(Width - apOffset, Height);
                       ArcTo(Width, Height - apOffset, false, true, apOffset, apOffset);
                       LineTo(Width + apDepth, Height / 2);
                       LineTo(Width, apOffset);
                       ArcTo(Width - apOffset, 0, false, true, apOffset, apOffset);
                       LineTo(apOffset, 0);";
                 _baseShape = new Shape(script, "Part");
                 _baseShape.TextArea = _baseLabelArea;

If I do not specify TextArea I see no error, or if I use a ElementTemplate instead of OutlineFormula, I see no error.
  

NullRef.txt ( 2 KB | 136 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: ShapeNode Null reference when specifying both OutlineFormula and Text Area
Reply #1 - Feb 4th, 2020 at 10:48am
Print Post  
Add some empty arrays for the other ElementTemplate[] properties and it will work -

Code
Select All
 _baseShape.TextArea = _baseLabelArea;
 _baseShape.Outline = new ElementTemplate[] {};
 _baseShape.Decorations = new ElementTemplate[] {};
 



The formula is still evaluated with higher priority than the arrays. We'll add null checks for next release.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
rdwheeler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: May 28th, 2008
Re: ShapeNode Null reference when specifying both OutlineFormula and Text Area
Reply #2 - Feb 11th, 2020 at 9:53pm
Print Post  
This works. Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint