Hello,
I am having a problem deleting rows in the cosmetic layer with MapBasic v7.
Simply put, I can create a text object in the cosmetic layer.  I can
promptly delete it. If I create another text object I cannot subsequently
delete it.  I believe the reason for this is that there are still 'deleted
rows' in the cosmetic layer left over from the previous deletes.  I've tried
a commit statement and a pack statement but I get an error message when I
try to use these on the selection of the cosmetic layer.  Is there something
else I can try to get rid of the deleted or empty rows?  Here is a sample of
my code:

Sub Crush_text_object_in_Cosmetic_layer
Set Map Redraw off
        'assume one or more text objects are in the cosmetic layer
        Dim thiscosmetic as string
        Dim object_count,x as smallint
        thiscosmetic = WindowInfo(frontwindow(),Win_Info_Table)
        object_count=TableInfo(thiscosmetic, TAB_INFO_NROWS)
        note "Total number of rows in the cosmetic layer is ="+object_count
        Set Map Layer 0 Selectable On
        Select * from thiscosmetic

                For x = 1 to object_count
                                If x = 1 then
                                        Fetch First from Selection
                                Else
                                        Fetch Next from Selection
                                End If
                                note "Fetch Row = " +x
                                myobj = Selection.obj
                                'note myobj
                                
                                If ObjectInfo(myobj, OBJ_INFO_TYPE) =
OBJ_TYPE_TEXT Then
                                        objstr =
ObjectInfo(myobj,OBJ_INFO_Textstring)
                                        If Left$(objstr,23) = "This map was
updated on" then  
                                        'the leading text contains 'This map
was updated on'
                                                note "Found an object
fitting the text criteria on row = "+x
                                                Set Map Layer 0 Editable On
                                                Delete from Selection Where
RowID = x
                                                'Commit Table Selection
                                                'Pack Table Selection Data
                                                Set Map Layer 0 Editable Off
                                        End If
                                End If
                Next

Set Map Redraw on
End Sub 

Thanks, Steve

Stephen Nabors
Systems Analyst
Market Support Services
Vulcan Materials Company

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 8202

Reply via email to