--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/42d6168a-4be8-4a83-a982-4426c46c8c40n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/d20466fc-c348-dafe-414a-c050a017a8fe%40routeware.dk.
Hi Gav
You may also consider restructuring you script and use a function to change the style of your objects.
This will perform better and also make it easier to add more tables to your script.
Include "MapBasic.def"
Declare Sub Main
Declare Sub ChangeRegionStyleForTable(ByVal sTab As String, ByVal penNew As Pen, ByVal brsNew As Brush)
Declare Function AlterRegionStyle(ByVal oRegion As Object, ByVal penNew As Pen, ByVal brsNew As Brush) As Object
'-------------------------------------------------------------------------------
Sub Main
Dim b1 As Brush
Dim p1 As Pen
b1 = makebrush (5,255,-1) '<--- Change values for your style
p1 = makepen (30,1,0) '<--- Change values for your style
Call ChangeRegionStyleForTable("MYTABLEONE", p1, b1)
b1 = makebrush (5,300,-1) '<--- Change values for your style
p1 = makepen (30,2,0) '<--- Change values for your style
Call ChangeRegionStyleForTable("MYTABLETWO", p1, b1)
End Sub
'-------------------------------------------------------------------------------
Sub ChangeRegionStyleForTable(ByVal sTab As String, ByVal penNew As Pen, ByVal brsNew As Brush)
Select * from MYTABLEONE
where Str$(obj) = "Region" into NewStyle NoSelect Hide
If TableInfo(NewStyle, TAB_INFO_NROWS) > 0 then
Update NewStyle
Set OBJ = AlterRegionStyle(OBJ, penNew, brsNew)
End If
Close Table NewStyle
End Sub
'-------------------------------------------------------------------------------
Function AlterRegionStyle(ByVal oRegion As Object, ByVal penNew As Pen, ByVal brsNew As Brush) As Object
AlterRegionStyle = oRegion
'**Only modify area types
If ObjectInfo(oRegion, OBJ_INFO_TYPE) In (OBJ_TYPE_REGION, OBJ_TYPE_RECT, OBJ_TYPE_ROUNDRECT) Then
Alter Object oRegion Info OBJ_INFO_BRUSH, brsNew
Alter Object oRegion Info OBJ_INFO_PEN, penNew
AlterRegionStyle = oRegion
End If
End Function
To add another table into the mix, you only have to add another three lines in the Main sub specifying the pen and brush, and then calling ChangeRegionStyleForTable.
I haven’t tried running this tool so there could be some minor mistakes
From: mapi...@googlegroups.com <mapi...@googlegroups.com>
On Behalf Of accumanddis trading
Sent: 6. juni 2021 23:35
To: mapi...@googlegroups.com
Subject: Re: [MI-L] Adding an ignore statement or 'IF statement' - if a table blank
This message originated Externally. Use proper judgement and caution with attachments, links, or responses. |
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/CAF8-M-CHpy%3Dz5Nuw28VeundUk3GpwqwMGuwMEE_s_5MVremyrw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/MN2PR16MB31179B3CC51803262643FDF996389%40MN2PR16MB3117.namprd16.prod.outlook.com.
Hi
You need to revert the order of the If and the Select statement:
From:
Include "MapBasic.def"
Dim oUpdateObj as Object
Dim b1 as Brush
Dim p1 as Pen
Dim x as Integer
If TableInfo(NewStyle,TAB_INFO_NROWS)>0 then
Select * from TEST_TABLE_1 where Str$(obj) = "Region" into NewStyle
To:
Include "MapBasic.def"
Dim oUpdateObj as Object
Dim b1 as Brush
Dim p1 as Pen
Dim x as Integer
If TableInfo(NewStyle,TAB_INFO_NROWS)>0 then
Select * from TEST_TABLE_1 where Str$(obj) = "Region" into NewStyle
The table NewStyle hasn’t been created when you check how many records it holds.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/d03eed87-57b7-4ede-9b18-3dd19bcd29afn%40googlegroups.com.