As part of a program, I am trying to process cartographic labels to change
them in responce to database changes. These exist as text objects in a map
layer, with attributes about the source of information they were derived
from.
I want to change their colour when the update doesn't work. The problem is
when I want to do a Alter Object call, I need to read the values of all
other text attributes. That should be easy enough, but when I try to
determine pointsize from the map, I get a value of zero, and this makes the
makefont clase invalid.
My question is whether there is a way that you can simply change text
colour of existing text in a map, and leave all other attributes the same.
The alternative is seems complex (see below) involving creating a new text
object within the minimum and maximum bounding rectangle, but I hate
complex solutions. My code is below...
TIA
Rob
CURRENT CODE AND OPTIONS
If MakeTextRed = True Then
currFontname = StyleAttr(ObjectInfo(textObj,OBJ_INFO_TEXTFONT),
FONT_NAME)
currFontStyle = StyleAttr(ObjectInfo(textObj,OBJ_INFO_TEXTFONT),
FONT_STYLE)
currPointSize = StyleAttr(ObjectInfo(textObj,OBJ_INFO_TEXTFONT),
FONT_POINTSIZE)
currForeColour = StyleAttr(ObjectInfo(textObj,OBJ_INFO_TEXTFONT),
FONT_FORECOLOR)
currbackColour = StyleAttr(ObjectInfo(textObj,OBJ_INFO_TEXTFONT),
FONT_BACKCOLOR)
MinExtent.x = ObjectGeography(textObj,OBJ_GEO_MINX)
MinExtent.y = ObjectGeography(textObj,OBJ_GEO_MINY)
MaxExtent.x = ObjectGeography(textObj,OBJ_GEO_MAXX)
MaxExtent.y = ObjectGeography(textObj,OBJ_GEO_MAXY)
TextRotation = ObjectGeography(textObj,OBJ_GEO_TEXTANGLE)
LabelLinePoint.x = ObjectInfo(textObj,OBJ_INFO_TEXTLINEX)
LabelLinePoint.y = ObjectInfo(textObj,OBJ_INFO_TEXTLINEY)
textSpace = ObjectInfo(textObj, OBJ_INFO_TEXTSPACING)
If gDebugModeOn Then
Print "Font: (" + currFontname + ", " + currFontStyle + ", " +
currPointSize +
", " + currForeColour + ", " + currbackColour + ")"
End If
'!!THIS WORKS OK
Alter Object TextObj Info OBJ_INFO_TEXTFONT,
MakeFont("Arial",1,10,RED,WHITE)
'!!THIS DOESN'T WORK
' Alter Object TextObj Info OBJ_INFO_TEXTFONT,
MakeFont(currFontname,1,currPointSize,RED,WHITE)
'OR DO I HAVE TO USE SOME FUNCTION LIKE THIS??
' CREATE TEXT INTO VARIABLE NewTxtObj strText
(MinExtent.x,MinExtent.y)(MaxExtent.x,MaxExtent.y)
' FONT MakeFont(currFontname,1,currPointSize,RED,WHITE)
' Spacing textSpace
' JUSTIFY LEFT ANGLE TextRotation LABEL LINE SIMPLE
(LabelLinePoint.x,LabelLinePoint.x)
Update gLabTab Set Obj = TextObj Where RowID = RowNum
Else
Alter Object TextObj Info OBJ_INFO_TEXTSTRING, strText
Update gLabTab Set Obj = TextObj Where RowID = RowNum
End If
Fetch Next From gLabTab
Robert Crossley
Trinity Software
10 Trinity Street
Parramatta Park
CAIRNS 4870
AUSTRALIA
Phone: 61-7-40314877
Fax: 61-7-40314810
email: [EMAIL PROTECTED]
web: www.trinitysoftware.com.au
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]