Easy Tip! Setting a default style for drawing new objects

MapInfo Pro™ Monthly Journal
Easy Tip! Setting a default style for drawing new objects
64 bitIf you have a table that you draw new objects in frequently and if the objects within the table are always the same style, then this is a handy tip! It is possible to set a default style such that any new objects added to the table will automatically be created with the default style.

This technique will help to keep the styles of all of your objects consistent.

To demonstrate this we will set up default drawing styles for the pipeline table, as seen in the map below. 

User-added image

Setting up the default style

This is easy to do! The default drawing style accessed from the Layer Properties dialog box. In Layer Control, Double-click the layer name or select the layer and click the Layer Properties button. 

User-added image

In the Layer Display tab, click the Styles for New Objects button.

An Insert Style dialog box will appear. Use this to choose your new default style. 

User-added image 

From this point forward, any new lines added to the table will use the line style chosen here. 

Note that the chosen style is stored in the TAB file. This style will be "remembered" whenever you use the table in the future, including in other map windows. 

Changing or removing the default style

Once a default style has been set, it is possible to change it as needed. Simply follow the same steps as above.

Removing a default style is not possible through the MapInfo Professional user interface. However the settings are stored in the TAB file as metadata settings. It is possible to open the TAB file in a text editor and remove the associated metadata. Here is the TAB file used in the example in this article. 

!version 300
!charset WindowsLatin1
Definition Table
Type NATIVE Charset "WindowsLatin1"
Fields 1
ID Char (10) ;
"\IsReadOnly" = "FALSE"
"\MapInfo" = ""
"\MapInfo\TableID" = "15af0b3e-d36d-4de3-ab95-784206951c25"
"\DefaultStyles" = ""
"\DefaultStyles\Symbol" = ""
"\DefaultStyles\Symbol\Type" = "1"
"\DefaultStyles\Symbol\Pointsize" = "18"
"\DefaultStyles\Symbol\Color" = "255"
"\DefaultStyles\Symbol\Code" = "38"
"\DefaultStyles\Symbol\Bitmap" = "" "\DefaultStyles\Symbol\Bitmap\Name" = ""
"\DefaultStyles\Symbol\Font" = ""
"\DefaultStyles\Symbol\Font\Description" = "MapInfo Oil&Gas"
"\DefaultStyles\Symbol\Font\Style" = "1"
"\DefaultStyles\Symbol\Font\ExtStyle" = "1"
"\DefaultStyles\Symbol\Font\Forecolor" = "0"
"\DefaultStyles\Symbol\Font\Backcolor" = "0"
"\DefaultStyles\Symbol\Font\Opaque" = "FALSE"
"\DefaultStyles\Symbol\Font\Rotation" = "0"
"\DefaultStyles\LinePen" = ""
"\DefaultStyles\LinePen\LineWidth" = "3"
"\DefaultStyles\LinePen\LineStyle" = "0"
"\DefaultStyles\LinePen\Color" = "16776960"
"\DefaultStyles\LinePen\Pattern" = "194"
"\DefaultStyles\Pen" = ""
"\DefaultStyles\Pen\LineWidth" = "1"
"\DefaultStyles\Pen\LineStyle" = "0"
"\DefaultStyles\Pen\Color" = "0"
"\DefaultStyles\Pen\Pattern" = "2"
"\DefaultStyles\Brush" = ""
"\DefaultStyles\Brush\Pattern" = "2"
"\DefaultStyles\Brush\Forecolor" = "16777215"
"\DefaultStyles\Brush\Backcolor" = "16777215"
"\DefaultStyles\Brush\Transparent" = "FALSE"


Additional comments

  • Choosing a default style does not impact existing objects in your table. All existing objects will retain their styles.
  • The default style only applies to objects that are drawn into the map window. If you copy and paste objects into a table or append objects to your table the newly added objects will retain their original style.
  • Once again, the style is stored within the TAB file so it is reused whenever the layer is ued again.
Do you have question?
Why not join our LinkedIn Group 
Feel free to post questions and I'm always happy to get suggestions for topics to appear in this journal.

 User-added image

Article by Tom Probert, Editor of "The MapInfo Professional" journal 

When not writing articles for "The MapInfo Professional", Tom enjoys talking to MapInfo Professional users at conferences and events. When not working he likes to see movies with car chases, explosions and kung-fu fighting.



UPDATED:  July 7, 2017