Mike,
I would recommend that you built your Set Map command using a command string:
sCommand = "Set Map Window " & MAP1
& " Layer " & S_OPEN_NAME
& " Display Graphic"
& " Label "
& " Line None"
& " Position "
& S_OFFSET_DIR
& " " &
S_LAB_FONT
& " Pen (1,2,0)"
& " With " &
S_LABEL
& " Parallel On
auto off Overlap Off Duplicates Off"
& " Offset " &
I_OFFSET_DIS
& " Visibility
On"
Run Command sCommand
HTH,
Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
Tel +45 6311 4900
Direct +45 6311 4908
Mob +45 5156 1045
Fax +45 6311 4949
E-mail [EMAIL PROTECTED]
http://www.cowi.dk/gis
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Jenne
Sent: Wednesday, December 28, 2005 10:09 PM
To: [email protected]
Subject: [MI-L] MapBasic Label Clause - Problems using variables as Positionand
Offset
Afternoon (here in the States, anyway) all!
I've run into a slight problem writing MapBasic code. In Set Map, I'm trying
to use variables for the Position and Offset portions of the Label clause. A
sample of this code is below. The intent of this piece of code is to extract
values (pertaining to labeling) from a reference table, which are then stored
into variables. Everything had worked just fine until I attempted to
incorporate variables for label offset values, specifically direction (Left,
Right, Center, Above, Below) and offset. For whatever reason, the MapBasic
compiler gives me an error statement, specifically "Missing "=" in assignment
to S_OFFSET_DIR". The line it's calling an error on is "Layer S_OPEN_NAME
Display Graphic Label Line None Position S_OFFSET_DIR.". If I substitute a
"normal" value (like "left") for S_OFFSET_DIR, then the error statement is
"Missing "=" in assignment to I_OFFSET_DIS" instead.
BTW, S_OFFSET_DIR is declared as a string variable, and I_OFFSER_DIS is an
integer. Also, all of the other variables in the label clause (such as
S_LABEL, S_LABEL_FONT.) had worked just fine.
Anyone have a guess as to what the problem might be?
Hope all is well with you all, and that everyone has a great New Year.
Mike Jenne
JCSI
Trussville, Alabama, USA
If FileExists(S_PATH_1) then
Open Table S_PATH_1 as S_OPEN_NAME
LAYER_CTR = LAYER_CTR+1 S_LABEL1 = ACTIVE_LAYER.LABEL
S_LABEL=S_LABEL1
I_FONTCL2 = ACTIVE_LAYER.FONT_CL2
I_FONTCL3 = ACTIVE_LAYER.FONT_CL3
I_FONTCL4 = ACTIVE_LAYER.FONT_CL4
I_FONTCL5 = ACTIVE_LAYER.FONT_CL5
S_LABEL1 = ACTIVE_LAYER.TYPE
S_OFFSET_DIR =ACTIVE_LAYER.OFFSET_DIR
I_OFFSET_DIS = ACTIVE_LAYER.OFFSET_DIS
S_LAB_FONT=MakeFont("Arial",I_FONTCL2,I_FONTCL3,I_FONTCL4,I_FONTCL5)
Add Map Window MAP1 Auto Layer S_OPEN_NAME
Set Map Window MAP1
Layer S_OPEN_NAME Display Graphic Label Line None Position
S_OFFSET_DIR Font S_LAB_FONT Pen (1,2,0)
With S_LABEL Parallel On auto off Overlap Off Duplicates Off
Offset I_OFFSET_DIS Visibility On
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l