-----Original Message-----
From: Ethan Hohneck <[EMAIL PROTECTED]>
To: 'Mapinfo-L (E-mail) <[EMAIL PROTECTED]>
Date: Thursday, September 02, 1999 6:10 PM
Subject: MI Changing a polygons Region Style in the same layer
>Good morning, good evening, and Good night to you all.
>
>I have just started to write MapBasic programs and am finding it very
>challenging.
>
>I have a scenario where i have a table that has a specific Brush and Pen
>styles set to it. From this layer i want to select particular polygons
>using a select query, and then change the polygon style to something
>different. I want to automate this process so because it is a weekly one,
>and i have to select a lot of different polygons and change their styles.
>
>So far i have:
>* opened the table,
>* selected the polygons from their field and their text description,
>* mapped the query and made it editable.
>* All the polygons come up selected.
You need to assign a style to each object in the selection.
This involves looping through the selection table, and, for each row:
- fetching the object into an object variable,
- altering the style of the object variable, then finally
- updating that row of the table with the new object.
Your code might look like this:
dim s_table as string
dim o_a as alias
dim r_a as alias
dim o as object
...
other code, which performs the query.
...
'
' After the query
'
s_table = SelectionInfo (SEL_INFO_SELNAME)
o_a = s_table +".obj"
r_a = s_table + ".rowid"
fetch first from s_table
do while not EOT(s_table)
if (o_a)
then o = o_a
Alter Object o
Info OBJ_INFO_BRUSH, MakeBrush(2, 32896, 16777215)
update s_table set obj = o where rowid = r_a
end if
fetch next from s_table
loop
close table s_table
Yes, it's a lot of trouble, but that's how it has to be done.
(There are plenty of ways to make this more flexible,
but they all boil down to the loop above).
However, you might consider abandoning the idea of
setting an a table's objects' intrinsic styles, and instead,
create a thematic layer after you add the table to a Map
window.
>Now i just need the final process, to change the style (Brush, and Pen) and
>then commit the table.
>
>I have been playing around with the following code.
>.............After the query
>Map From Selection
> Set Map Layer 1 Editable On
>
> Dim WRC_b As Brush
> dim selectionobj as object
>
> WRC_b = ObjectInfo(Selectionobj,OBJ_INFO_BRUSH )
> Alter Object Selectionobj
> Info OBJ_INFO_BRUSH, MakeBrush(2, 32896, 16777215)
>
>This compiles but doesnt work. It says "Can not use an unitialized object
>variable in and expression"
>
>I dont know if this is the correct way to change the region style, CAN
>ANYONE POINT ME IN THE RIGHT DIRECTION.
>
>Thanks heaps.
>
>Ethan Hohneck
>SWDC
>Tokoroa
>New Zealand
>
>----------------------------------------------------------------------
>To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
>"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]