Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Shape text size (Read 4721 times)
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Shape text size
Dec 20th, 2011 at 10:50am
Print Post  
Hello,

In a Box using a Shape, how can I obtain the available text size (width).

This allows me to change the format and content of the text according to the available size and the measurestring function.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape text size
Reply #1 - Dec 20th, 2011 at 12:36pm
Print Post  
Hi,

The control draws text in this area:

// 1 mm margins
float mm = Constants::millimeter(m_pfcParent->getMeasureUnit());
::InflateRect(&rcBox, -mm - abs(m_nPenWidth), -mm - abs(m_nPenWidth));

where millimeter() returns 96.0f / 25.4f for the default unit of pixel. So you should subtract 2 * (box.PenWidth + 96.0f / 25.4f) from the box width to find the text area width.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Re: Shape text size
Reply #2 - Dec 20th, 2011 at 12:59pm
Print Post  
Thanks, but I don't understand very well your answer (I work with PowerBuilder but you can give me an answer for Visual Basic).

I will explain more clearly what I need.

If your choose the predefined shape Procedure, the text zone is not totally the box width.
The right and the left part of the shape is not writable.
The text area is smaller than the box width (70% : 15% on the left and 15% on the right are not parts of the text area).

My question is how can I know the text area width ?

Thanks a lot

PS : I understand that if I use the Star Shape, it will be more difficult (or impossible -> the text area is not a square) Wink
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape text size
Reply #3 - Dec 20th, 2011 at 4:12pm
Print Post  
Sadly, there isn't any easy way to get the text area definitions. I could give you more information if Powerbuilder can access C++ structures. Then you would be able to access the text area points through a structure like this:

struct DefinitionPart
{
     vector<POINT> points;
     vector<short> segmentTypes;
};

by calling box.Shape.GetDefinition(2 /* text def */, &definitionPart /* address of */).

Otherwise, I could upload here the C++ code used to define all shapes and you will have to copy the text coordinates in some format you can access from Powerbuilder.

Stoyan
  
Back to top
 
IP Logged
 
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Re: Shape text size
Reply #4 - Dec 20th, 2011 at 4:27pm
Print Post  
Unfortunately, Powerbuilder is a language that does not communicate very well with C ++ applications.

For example, I am trying all the day to get the definition of an anchorpoint of an AnchorPattern of a box using GetAnchorPointF function and it does not function -> Powerbuilder abort. It seems to be a declaration of a datatype problem but what ?

I give you an example of this code to show you this fact.

[code]
oleobject ancpattern
real x1, y1
integer mark, ArrowStyle
integer segmentcount
unsignedlong color
boolean incoming, outgoing, changeArrowStyle
string pattern

ancpattern = create oleobject
ancpattern.connecttonewobject("Flowchart.AnchorPattern")
ancpattern = ao_dst.AnchorPattern()
segmentcount = ancpattern.AnchorPointCount()
pattern = ancpattern.PatternId()
ancpattern.GetAnchorPointF (anchor_org, REF x1, REF y1, REF incoming, REF outgoing, REF mark, REF color, REF changeArrowStyle, REF ArrowStyle, REF SegmentCount)
[/code]

If you find something tell me it.

For this topic, you can send me your C++ code to define all the shapes and I will try to translate it in a PowerBuilder script.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape text size
Reply #5 - Dec 21st, 2011 at 11:11am
Print Post  
You can find a link to the code on the private messages page.

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