Text Alignment

#1
I am using VBA to insert some text. There appears to be a problem with the alignment when text is aligned with horizontal-middle and horizontal-center. I am using the following code:

objtext.HorizontalAlignment = vicHorizontalAlignmentMiddle
objtext.Update
objtext.Move tBase, tcasStart

When the text appears onscreen is does not quite center. If I double click on the text as if I were to change properties and click okay the text will snap to the proper position. The left and right alignments seem to function properly.

Am I setting the alignment right or is this a bug with text?

Running latest PE version, Win98SE.

thank you,

ssc

#2
A little further information. Try the following bit of code:

Private Sub testing()

Dim objMText As IntelliCAD.MText
Dim OBJTEXT As IntelliCAD.Text
Dim pMT As IntelliCAD.Point
Dim pT As IntelliCAD.Point
Set pMT = IntelliCAD.Library.CreatePoint(6, 6)
Set pT = IntelliCAD.Library.CreatePoint(6, 4)
Set objMText = IntelliCAD.ActiveDocument.ModelSpace.AddMText(pMT, 12, "THIS IS A TEST OF MTEXT")
MsgBox objMText.InsertionPoint.x
objMText.AttachmentPoint = vicAttachmentPointMiddleCenter
objMText.Update
Set OBJTEXT = IntelliCAD.ActiveDocument.ModelSpace.AddText("THIS IS A TEST", pT, 0.2)
OBJTEXT.HorizontalAlignment = vicHorizontalAlignmentMiddle

OBJTEXT.Update

End Sub

It appears that MText aligns properly but Text does not. If the text object is given any alignment other than default the insertion point is not what is passed to it. There appears to be a definite problem with plain text and VBA.

Can someone confirm this?

I tried this on a machine running Win2000 also with the same results.

Is VBA being given some attention for the next release?

thank you,

ssc

[This message has been edited by ssc (edited 10-16-2002).]

[This message has been edited by ssc (edited 10-16-2002).]

#3
It appears that the textalignmentpoint must also be set for plain text:

OBJTEXT.TextAlignmentPoint = pT

Why is this the case??

Am I missing something, why do I need to set the textalignmentpoint also?

thank you,

ssc

#4
A little more information.

It appears that the text alignment command must appear immediately following the AddText command (no other code in between) or unreliable results will happen.

Also, either I do not have the right combinations yet or the alignment functions do not behave nicely (probably both).

Some problems arise since IntelliCAD does not have alignment combinations accessible from VBA, ie, middleleft, text must be positioned with a vertical and horizontal alignment command. The second action will move the text from the original insert point.

Any thoughts on this subject would be appreciated.

thank you,
ssc

[This message has been edited by ssc (edited 10-17-2002).]

#5
ssc,

In the early days there was a problem with the text position - It was always positioned at point 0,0,0 no matter what insert point was given. My work-a-round was to insert the text then use the move method to position the text.

This was fixed and there is still some minor errors that you need to code around the problem.

------------------
Regards
John Finlay

#7
It appears that Win98se does not like IntelliCAD as well as it does Win2000. I can get the text to align properly on a machine that is runnig Win2000 but not Win98se.

#8
ssc

I can't see how the operating system could make a difference to the location of text however, most of ICAD's early development environment was in Windows NT.

I was using Windows 98se in the early days and now XP Pro.

One problem I had was having multi-versions of ICAD on the one computer and it took a complete clean-up to solve the corruption problems.

Sometimes a complete registry clean out and a re-install will solve what looks like a bug. It is hard when you only have one computer to test thing on because you don't have anything to compare the computer's results with.

You could try another computer with Windows 98se to see if it is the operating system. It would be nice to know.



------------------
Regards
John Finlay

#9
Thank you for the reply John.

I did do a "clean" install of the latest version. I wiped the registry prior to installing.

I managed to get the text aligned properly by putting the text into a block and then exploding it. When the block is exploded the text "snaps" to the proper position. Apparently when vba makes the text it doesn't quite initialize it properly. I have had other strange things happen with this machine. It may or may not be Win98se.

Thank you again,

ssc