Hi Laurence
The trick is to write a function and then use it in a update expresion
NB The SET TABLE FASTEDIT ON /OFF makes the update faster
Try this code
Include "MapBasic.def"
Dim Main
Dim Function NewStyle(byval o as object , Byval s as string)as object
sub Main
note "Run"
Set table MyTab fastedit on
Update MyTab set obj = NewStyle(obj, STR_NEW)
commit table MyTab
set table MyTab fastedit off
end sub
Function NewStyle(byval o as object , Byval s as string)as object
Dim newObj as object
run command "Set Style pen Make" & s
newObj = o
Alter Object newobj Info OBJ_INFO_PEN,CurrentPen()
NewStyle = newObj
End Function
Peter laulund
National Survey and Cadastre, Denmark
points <[EMAIL PROTECTED]> - 29-08-99 15:26:44
Til:"mapinfo-l (E-mail)" <[EMAIL PROTECTED]>
cc: (bcc: Peter Laulund/MI/KMS)
Vedrørende:MI MB: Changing styles
MB: Changing styles
Hi Mappers,
I have a table called STR_NEW (lines and polylines) that has a text
field called "stylenew" containing different pen styles:
Pen(1,1,32768)
Pen (1,2,16736352)
Pen (1,1,32768) and so on...
I need to use code to change each record's object style to
the corresponding pen style from within the field.
I've tried various combinations of the following to no avail:
Sub Main
Dim pen_var As Pen,
newobj As Object
newobj=STR_NEW.obj
pen_var = STR_NEW.stylenew
Alter Object newobj Info OBJ_INFO_PEN,stylenew
End Sub
I know the solution must be simple. I really appreciate it!
Laurence Seeff
Points Business Mapping Ltd.
Israel
--
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]