Generating legend labels when style override is active

121 views
Skip to first unread message

Keith Balmer

unread,
Jan 27, 2017, 10:59:22 AM1/27/17
to MapInfo-L
I'm trying to generate a legend and have a problem with getting the labels to show. (I'm using MapInfo Pro 15.0)

I've tracked the problem to style override. With a map containing just one layer, if style override is not active then the following

Create Designer Legend From Window 656411176 Frame From Layer 1 Using column object label "Fred"

works fine and the label "Fred" appears alongside the frame in the legend as expected.

If however style override is active on the layer then I don't get the label at all. It is completely missing.

Can anyone help please?

Thanks, Keith

Keith Balmer

unread,
Jan 27, 2017, 11:18:50 AM1/27/17
to MapInfo-L
P.S. I've since discovered that having generated a legend with style override active (and therefore had no label), if style override is then turned off the label magically appears in the legend!

If style override is then turned on again the label remains and doesn't disappear.

Something weird going on...?

Keith

Michele Buselli

unread,
Jan 30, 2017, 10:38:02 AM1/30/17
to MapInfo-L
Hi Keith,

What do you have set in Legend Preferences (Options > Preferences > Legend Window) for the Style Name Pattern? If you haven't changed the default Style Name Pattern there should be a '%' character in the edit text box. Is the text box blank instead? You can also tell if the Style Name Pattern default has been changed if, when creating the Legend in the GUI, you step through the Create Legend wizard. In step 2 take a look at how the Style Name Pattern is set. 

-Michele Buselli
Pitney Bowes 

Keith Balmer

unread,
Jan 30, 2017, 11:22:36 AM1/30/17
to MapInfo-L
Hi Michele,

The % character is still present in Options > Preferences > Legend Window > Style Name Pattern. It is also still there if I create a new legend designer via the GUI, except that when I create a legend this way it puts "Region" next to the frame (as expected) rather than leaving it blank. I'm not using the GUI however to generate the legend, I'm using MapBasic.

The problem is really easy to re-create. Just open up new version of MapInfo pro 15.0. Open a table containing a single polygon. Set style override on it, then in the MapBasic Window paste 'Create Designer Legend From Window 354944664  Frame From Layer 1 Using column object label "Fred"' (obviously changing the window number as required). Here's my entire session transcript from the MapBasic window...

Open Table "Z:\Temp\Keith\Data Requests\SitesSearchArea.TAB" Interactive
Map From SitesSearchArea
Set Map Window 354944664  Layer 1 Display Global  Global Pen (1,2,0)   Global Brush (2,16711680,16777215)   
Create Designer Legend From Window 354944664  Frame From Layer 1 Using column object label "Fred"

This will create a legend without a label. The label "Fred" will appear when style override is turned off...

My workaround is now to generate the legend before enabling style override. This seems to work okay.

Regards, Keith

Michele Buselli

unread,
Jan 31, 2017, 4:16:05 PM1/31/17
to MapInfo-L
HI Keith,

Right, the GUI checks what the preferences are, but the MapBasic doesn't generally do that. Since a style override is on and there's no default pattern style in your MapBasic statement, the label ends up blank. You could add " Default Frame Style "%"  " to your MapBasic

Create Designer Legend From Window 354944664 Default Frame Style "%"   Frame From Layer 1

and you should get the "Region" label. 

But your workaround is fine too!

-Michele

Keith Balmer

unread,
Feb 1, 2017, 8:58:42 AM2/1/17
to MapInfo-L
Hi Michele,

I've tried adding in Default Frame Style "%" as in:

Create Designer Legend From Window 396282904 Default Frame Style "%" Frame From Layer 1 Using column object label "Search Area for Sites"

but now it adds the label "Region" instead of the label that I want it to show ("Search Area for Sites").

What is the syntax for creating a legend frame using my own label when style override is already active please? I seem to only be able to add my own label when style override isn't active. (I don't understand why overriding the style should have any effect on a label - maybe I'm missing something?).

Regards, Keith
Reply all
Reply to author
Forward
0 new messages