MapBasic MapInfo refresh

1,215 views
Skip to first unread message

Anna Dougherty

unread,
Dec 6, 2011, 7:43:33 PM12/6/11
to MapInfo-L
Hi List users,
I have a problem with refreshing the map when using MapBasic code. I
have code that will set the translucency of a GRD or GRC layer to 50%.
Sometimes when I run it, it will work. Sometimes it will not work. If
I manually go into the layer control properties, and set the
translucency, it will work every time the code is run after that. Does
anyone know of a command that will force the map to redraw correctly.
I have tried "Set Map Redraw On" and "Update Window FrontWindow()" but
neither of them work consistently. Any ideas?

Many thanks,
Anna

SMITH,Stephen (ACT)

unread,
Dec 6, 2011, 9:31:05 PM12/6/11
to mapi...@googlegroups.com
I would try Set Redraw OFF, add some layers or make all the change and then Set Redraw ON after all the changes have been made. If that does not work you might try turning on the enhanced rendering settings. Let me know how it goes.

Set Window WinID Enhanced ON Smooth Text Antialias Smooth Image High Smooth Vector Antialias

Regards
Steve Smith
Geospatial Intelligence & Support
Research Branch
Social Policy & Economic Strategy Group
Dept of Education Employment and Workplace Relations
email:- Stephen...@DEEWR.gov.au
Wk:- (02) 6240-9048
Location:- Level 5, near C11
50 Marcus Clarke St, Canberra City Act 2601
GPO Box 9880 Canberra Act 2601

Many thanks,
Anna

--
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
Notice:

The information contained in this email message and any attached files may be confidential information, and may also be the subject of legal professional privilege. If you are not the intended recipient any use, disclosure or copying of this email is unauthorised. If you received this email in error, please notify the sender by contacting the DEEWR Switchboard on 13 33 97 (1DEEWR) during business hours (8am - 8pm AEST) and delete all copies of this transmission together with any attachments.

Peter Horsbøll Møller

unread,
Dec 7, 2011, 2:52:48 AM12/7/11
to mapi...@googlegroups.com
You could alos try to set the map in a state of no update using this statement:

Set Map Redraw Suspended

and then afterwards to on the map redraw:

Set Map Redraw On

Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo


2011/12/7 SMITH,Stephen (ACT) <Stephen...@deewr.gov.au>

Anna Dougherty

unread,
Dec 7, 2011, 5:57:12 PM12/7/11
to mapi...@googlegroups.com
Thanks Stephen and Peter for your help. I tried your suggestions, and they both work for refreshing the map, but only if I first go into the layer control and manually change the translucency for every layer. If I do not do that, then
the map stubbornly refuses to refresh. It's a mystery to me!
Here is my code...
 
    Set Event Processing Off    
    'Set Map Redraw Off
    Set Map Layer SelectedlayerNumber Translucency 100
    Set Event Processing On
    'Set Map Redraw On
 
I tried both "Set Event Processing Off" and "Set Map Redraw Off", but neither of them worked consistently, unless I first set the values manually, in which case they both work perfectly. There may be up to 17 GRC or GRD layers that I want to make translucent. I am using an array to loop through the layer numbers (SelectedlayerNumber). What do you think?
 
Thanks again for your help.
 
Best wishes,
Anna

Scott.S...@bell.ca

unread,
Dec 7, 2011, 6:14:06 PM12/7/11
to mapi...@googlegroups.com

Hello,

 

What is the command to access the old layer control in MapInfo version 11.0.  I  find the old layer control much faster for Map creation.

 

Thanks

 

Scott

Sally4

unread,
Dec 8, 2011, 5:33:41 AM12/8/11
to MapInfo-L
Menu Command 801

On Dec 7, 11:14 pm, "Scott.Snash...@bell.ca" <Scott.Snash...@bell.ca>
wrote:

Anna Dougherty

unread,
Dec 14, 2011, 7:27:12 PM12/14/11
to mapi...@googlegroups.com
I have one more question about my MapBasic program. I am switching on and off selected layer names to do the screenshots. Thing is, the screenshot layer names are only 30 characters long (as they are in the layer control in MapInfo). Would it be possible to grab the complete layer name (as seen in the tooltips when hovering over the layer control in MapInfo)? Most of my layer names are over 30 characters long, and it's hard for the users to determine which one they need to choose.
 
Best wishes,
Anna

Thomas Bacon

unread,
Dec 15, 2011, 3:25:26 AM12/15/11
to mapi...@googlegroups.com

Hi Anna,

 

Have you tried the LayerInfo() function with LAYER_INFO_NAME as the attribute? I’m not sure whether this will return the full name, but it’s worth a try if you haven’t already.

 

Regards,

 

Tom Bacon

Graduate GIS Engineer

Asset Management South

Tel: 01444 472380

www.mouchel.com

 




The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. Mouchel Limited, Registered in England at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX Registered No : 1686040

Peter Horsbøll Møller

unread,
Dec 15, 2011, 4:02:07 AM12/15/11
to mapi...@googlegroups.com
Anna,
You can get to the filename of the layer thru PathToFileName$(LayerInfo(nLayer, LAYER_INFO_PATH))

LayerInfo(nLayer, LAYER_INFO_PATH) will give you the path to the tab file "behind" the layer
PathToFileName$() will extract the file name from a path (remember there is a difference between the table name and the file name)

If you don't want the .TAB neding you can remove that as well:

Left$(PathToFileName$(LayerInfo(nLayer, LAYER_INFO_PATH)), Len(PathToFileName$(LayerInfo(nLayer, LAYER_INFO_PATH))) - 4)

But this would require that you write some kind of interface (a window/dialog) of your own and lets the users use this.

Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo


2011/12/15 Anna Dougherty <annamariely...@gmail.com>

Anna Dougherty

unread,
Dec 15, 2011, 11:55:47 AM12/15/11
to mapi...@googlegroups.com
Thank you Thomas and Peter! I was already using Layer_Info_Name to get the layer names, but that is limited to 30 characters. I looked into Layer_Info_Path, but hadn't quite figured out how to parse the result, and now Peter has told me! Thank you both so much for your help!
 
Best wishes,
Anna

Anna Dougherty

unread,
Feb 17, 2012, 1:09:20 PM2/17/12
to mapi...@googlegroups.com
Hi all, I just upgraded to MapInfo v10.5, and the same thing is happening again with my code. I can run the code and set the Alpha or Translucency variables on the layer to make the layer invisible (Alpha = 0 or Translucency = 100). If I then look at the layer properties in the layer control, the Translucency is set to 100%. But, the layer is still visible onscreen. I have tried various combinations of "Set Event Processing Off/On", "Set Map Redraw Off/On", "Set Window Front Window() Enhanced On", "Set Map Redraw Suspended/On", but the layer is still visible on screen. Is there anything I can do to make this layer invisible (it is a raster layer)?
 
Thanks for your help.
Best wishes,
Anna

Peter Horsbøll Møller

unread,
Feb 19, 2012, 4:30:28 PM2/19/12
to mapi...@googlegroups.com
Anna,
Have you installed the updates fro 10.5? I think we did some issues with translucency in one of those.

Peter Horsbøll Møller
Pitney Bowes Software



2012/2/17 Anna Dougherty <annamariely...@gmail.com>

--

Anna Dougherty

unread,
Feb 20, 2012, 12:40:49 PM2/20/12
to mapi...@googlegroups.com
Hi Peter, I just tried some MapBasic code in MapInfo v11.0.3 (the latest release available from the PB website). The code (as as test), simply sets three raster layers to be 100% translucent. When the code finishes, if I look at the layer properties, the translucency is set to 100% for all three layers. All three layers are still visible on screen though. I think that the problem is to do with the screen refresh rather than the Set..Map layer command. What do you think? What issues did you have with translucency in MapInfo v10.5?
 
Thanks for all your help.
 
Anna

Peter Horsbøll Møller

unread,
Feb 20, 2012, 1:48:23 PM2/20/12
to mapi...@googlegroups.com
Anna,
Could you share your very basic sample code?

I recall there was an issue where setting one layer tranlucent, affected other layers - or something similar.

Peter Horsbøll Møller
Pitney Bowes Software



2012/2/20 Anna Dougherty <annamariely...@gmail.com>

Anna Dougherty

unread,
Feb 20, 2012, 5:43:39 PM2/20/12
to mapi...@googlegroups.com
Hi Peter, no problem, here is my sample code.
 
First I get a list of layers that the user wants to make transparent.
Then I loop through the list of layers and set each layer (SelectedLayerNumber) to be transparent.
 
For each layer I do the following:
 
  Set Event Processing Off  

  Set Map Layer SelectedlayerNumber Translucency 100 
  Set Event Processing On
  Update Window FrontWindow()
 
This does not work, the layer is set to 100% translucent in the layer properties, but the layer remains on the map.
 
Thank you so much for your help!
 
Anna

Peter Horsbøll Møller

unread,
Feb 21, 2012, 2:57:54 AM2/21/12
to mapi...@googlegroups.com
Hi Anna,

I had a glance at this and the problem is that when you set the translucency on a raster layer, you actually set the "global style" of the layer.
So in order to also see the change in the map, you also need to set the layer to use the global style and not the "graphic style" from the table itself

This statement should do the trick:
Set Map Layer SelectedlayerNumber Display Global Translucency 100 

Anna Dougherty

unread,
Feb 21, 2012, 7:35:28 PM2/21/12
to mapi...@googlegroups.com
Hi Peter, thank you so much for your help! It worked perfectly! I would never have figured that out, thank you so much!!
 
Anna

Wernfried Domscheit

unread,
Mar 3, 2015, 5:13:37 AM3/3/15
to mapi...@googlegroups.com
The solution did not work for me however, I found the reason. You must enable "Enhanced Rendering" for your MapInfo.

This you can do either in Menu Options -> Preferences -> Styles -> tick "Enable Enhanced Rendering" or via MapBasic code:

Set Window FrontWindow() Enhanced On

Kind Regards
Reply all
Reply to author
Forward
0 new messages