Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Multi-line Boxes Vertically Aligned (Read 4249 times)
Frosty555
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: May 16th, 2007
Multi-line Boxes Vertically Aligned
May 16th, 2007 at 5:22pm
Print Post  
When I set the TextStyle of a box in FlowChartX to be tsCenterML or tsFitPolyCenter, it aligns the text to the center of the box horizontally, but vertically it is aligned at the top.

Is there no way to make multi-line text centered vertically as well?

My flowchart is dynamically created from a database, so I can do whatever tricky workarounds anyone can think of.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi-line Boxes Vertically Aligned
Reply #1 - May 16th, 2007 at 5:30pm
Print Post  
What is the Style of the boxes used in your application? tsFitPolyCenter centers the text vertically, but it works only for Box.Style = bsShape.

Stoyan
  
Back to top
 
IP Logged
 
Frosty555
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: May 16th, 2007
Re: Multi-line Boxes Vertically Aligned
Reply #2 - May 16th, 2007 at 6:14pm
Print Post  
Ah! That did it! Thank you!

I was using bsRoundRect as my BoxStyle, the default value. Changed it to bsShape and the textstyle to tsFitPolyCenter now it's centered!

Though, I can't use a rounded rectangle. I have to use one of the shapes in the shape library. There's quite a selection though, they look rather fancy Wink.

Maybe I'm blind... but I can't find one that's just a normal rounded rectangle. Is there one or should I just stick with square rectangles?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi-line Boxes Vertically Aligned
Reply #3 - May 17th, 2007 at 5:32am
Print Post  
Hi,

Have you tried the "RoundRect" shape?

Stoyan
  
Back to top
 
IP Logged
 
Frosty555
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: May 16th, 2007
Re: Multi-line Boxes Vertically Aligned
Reply #4 - May 17th, 2007 at 11:32am
Print Post  
It appears to not exist. O.o Not in the help, and when I put it into my program I get an unspecified OLE error which I assume means it isn't in the collection.

I am using the professional edition of v2.3. Tongue It's probably a little dated now, we bought the license two years ago.

Unfortunately, since we use flowchartx in several places, I don't think we'll be upgrading the version for fear of breaking stuff elsewhere in the software.

It's okay though! I'm well on my way now. Thanks Stoyan.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi-line Boxes Vertically Aligned
Reply #5 - May 17th, 2007 at 11:47am
Print Post  
You are right, I have tested an older version from our archives and it does not have a "RoundRect". I guess you can define your own shape; here is how it looks in the current version -

// RoundRect
CComObject<ShapeTemplate>::CreateInstance(&shape);
shape->AddRef();
shape->AddOutlineStraight(10, 0);
shape->AddOutlineArc(80, 0, 100, 20, -90, 90);
shape->AddOutlineStraight(100, 10);
shape->AddOutlineArc(80, 80, 100, 100, 0, 90);
shape->AddOutlineStraight(90, 100);
shape->AddOutlineArc(0, 80, 20, 100, 90, 90);
shape->AddOutlineStraight(0, 90);
shape->AddOutlineArc(0, 0, 20, 20, 180, 90);
shape->CompleteDefinition(_T("RoundRect"));

Stoyan
  
Back to top
 
IP Logged
 
Frosty555
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: May 16th, 2007
Re: Multi-line Boxes Vertically Aligned
Reply #6 - May 17th, 2007 at 1:25pm
Print Post  
Hmmm... o.o version 2.3 doesn't have an "AddOutlineArc" method. It only has "AddOutlineBezier", which comes out with...



Well, lets say its not quite what we wanted XD haha.

But! No worries. I did some research into Beziers and fixed it up.


Here's the equivalent code in Visual FoxPro. It's fairly similar to VB for anyone reading the thread.


LOCAL oshapetemplate as FLOWCHARTLib.ShapeTemplate
oshapetemplate = CREATEOBJECT("FlowChartPro.ShapeTemplate")
oshapetemplate.AddOutlineStraight(10, 0)
oshapetemplate.AddOutlineBezier(90, 0, 100, 0, 100, 10)
oshapetemplate.AddOutlineStraight(100, 10)
oshapetemplate.AddOutlineBezier(100, 90, 100, 100, 90, 100)
oshapetemplate.AddOutlineStraight(90, 100)
oshapetemplate.AddOutlineBezier(10, 100, 0, 100, 0, 90)
oshapetemplate.AddOutlineStraight(0, 90)
oshapetemplate.AddOutlineBezier(0, 10, 0, 0, 10, 0)
oshapetemplate.CompleteDefinition("RoundRect")
ochart.DefaultShape = ochart.Shapes("RoundRect")
ochart.BoxStyle = 10 && bsShape


It looks like this now:



It's not quite perfect since it uses percentages instead of pixel values. You can see on rectangles the curves are stretched out. But I'll tweak it so it looks best with the shapes we'll be using. Mostly 2:1 rectangles instead of squares. There are only a couple very specific height/width proportions that we'll be using, I can make a couple of these shapes for 1:2 and 2:1 rectangles and pick the appropriate one when the flowchart is rendered from the database.

Now that I have control over the shape I can do anything I want!

Yay! This is quite good 8)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi-line Boxes Vertically Aligned
Reply #7 - May 17th, 2007 at 1:51pm
Print Post  
Why, most of your users would choose the first shapes, if you'd let them to Wink
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint