News:

Be sure your post is relevant to the current discussion.  Create a new topic within the appropriate board if you are unsure.

Main Menu

AddText Method

Started by H.S, November 30, 2009, 05:38:49 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

H.S

Hello,

the member function (method) "AddText" requires in its
Parameter list for the parameter "offset" and "justification"
apparently imsi data types (?). I have these types of data already
sought in the header files and not found.
They are: "ImsiTextOffset" and "ImsiTextJustification"
The SDK Documentation is also not explained or I
understand something wrong. Do you know what exactly should be used as a value
should or can?

Greeting
H.S

ibruethsch

Hi H.S.
A good way to find out what is not documented is to use the macro-recorder.
Start the recorder
Select a text
Change the justification

Stop the recorder
And have a look to the recorded script.

Best regards
Bernd

H.S

Hi Bernd,

this is a good idea.  I tried it once
and get integer values.

ActiveDrawing.Properties ( "$ EXTERNALJUSTIFY") = "2050"
ActiveDrawing.Properties ( "$ EXTERNALJUSTIFY") = "514"

These values were in use in a program
the desired text alignment.
Do you know how to compose these values?

Best regards,
H.S.

ibruethsch

Hi H.S.
when I select a text-item
start the recorder
change the justification from
top left to middle center
it is recorded in this way:

For Each gxChild in Selection
   gxURec.AddGraphicForModify gxChild
   gxChild.Properties("TextFormat") = 514
Next

If you want to change the jusification for single selection (only one item)

ActiveDrawing.selection.item(0).Properties("TextFormat").value = 514


best regards
Bernd

cwcookman

#4
A few years ago Tom Snape helped me out with this issue.

The attached Function will return the justification parameters for the AddText method.

'**********************************************************************************************************

'**********************************************************************************************************
' Function........: GetJustification
' Description.....: Calculates Justification parameter for
'                   AddText Method
' Arguments.......: strTextJust     -   Justification String
'                   strTextOffset   -   Offset String
'Returns..........: Justification parameter as integer
'Reference........: Tom Snape 2001
Function GetJustification(strTextJust As String, strTextOffset As String) As Long
   Dim hj As Long
   Dim vj As Long
   hj = 0
   vj = 0
   If strTextJust = "Left" Then
       hj = 1
   ElseIf strTextJust = "Center" Then
       hj = 2
   ElseIf strTextJust = "Right" Then
       hj = 4
   End If
   If strTextOffset = "Top" Then
       vj = 256
   ElseIf strTextOffset = "Middle" Then
       vj = 512
   ElseIf strTextOffset = "Baseline" Then
       vj = 1024
   ElseIf strTextOffset = "Bottom" Then
       vj = 2048
   End If
   GetJustification = hj + vj
End Function

'**********************************************************************************************************


an abridged example call follows:


Dim lJustOff as Long
lJustOff = GetJustification("Left", "Top")
Set Gr = Grs.AddText(sText, X, Y, Z, Height, Angle, , , lJustOff)



I hope this helps.
CWC

cwcookman

I just realized there is an error in the GetJustification Function I posted December 03, 2009.

The second to the last line was:
Justification = hj + vj

It should have been:
GetJustification = hj + vj

The code sample now reflects the change.

CWC




CWC