Hi Andy

1: You can query the name of the map in frame object try to open a layout
with 1 frame and then run this code from the MapBasic window.

First set your map as the frontwindow and then run this line
set window frontwindow() Title "MyMap"

then open a layoute window  and run the rest
dim fobj as object
select * from layout1 where Str$(obj) = "frame"
fobj = selection.obj
print objectinfo(fobj,6)


2: You can get the name of any layoute with the WindowInfo() function, try
this in the MB window
Print  WindowInfo(frontwindow(),10)


3: In order to set a window as the front window you need to know the id
number  off your - window try this:
set  your map window as the frontwindow and then run this code from the
mapbasic window
Dim WinId as integer
WinId = FrontWindow()

Set your layoute window as the frontwindow and then run

Set Window WinId Front

Peter Laulund
National Survey and Cadastre, Denmark






"Andy" <[EMAIL PROTECTED]> - 30-04-99 17:26:31

Til:    "mapinfo mailing list" <[EMAIL PROTECTED]>
cc:      (bcc: Peter Laulund/MI/KMS)
Vedr�rende:    MI SUM: VB: finding layout scale



I thought i'd summarise my look into automated layout scales. The following
was the only method i could find to work - but its a bit of a bodge job...

firstly, there was no way of querying the layout for details on particular
fram objects, namely my map window. But i could use MapperInfo to retrieve
some scale value from the map window. The trick is to make the map window
and the map frame in the layout window the same size in width and height.
This is good news because it now means that the scale in each window is the
same. Unfortunately, and i don't know why, the MapperInfo_Scale function
was returning a number that was correlating with a change in scale but was
at a different ratio. For example, the true scale was 1:500 but my
MapperInfo_scale output was giving a reading of 6.2. I checked all my units
and couldn't find any faults. But testing the results out at different
scale settings provided me with a formula:

    true scale = (83.028 x Mapscale) + 0.0124

Now the true scale of the map has been found this is the same as the map
frame in the layout and a text string can be placed accordingly. Use
CInt(x) to turn the value into a integer and whack into the layout.

The only annoying thing that i don't understand is how to make a window
active without altering any of its settings or by using the user to clcik
on it. ArcView's avenue had SetActiveDocument and i'm looking for a
compromise statement.

regards,
andrew bailey
gis officer
london borough of hackney

I thought i'd summarise my look into automated layout scales. The following was the only method i could find to work - but its a bit of a bodge job...
 
firstly, there was no way of querying the layout for details on particular fram objects, namely my map window. But i could use MapperInfo to retrieve some scale value from the map window. The trick is to make the map window and the map frame in the layout window the same size in width and height. This is good news because it now means that the scale in each window is the same. Unfortunately, and i don't know why, the MapperInfo_Scale function was returning a number that was correlating with a change in scale but was at a different ratio. For example, the true scale was 1:500 but my MapperInfo_scale output was giving a reading of 6.2. I checked all my units and couldn't find any faults. But testing the results out at different scale settings provided me with a formula:
   
    true scale = (83.028 x Mapscale) + 0.0124
 
Now the true scale of the map has been found this is the same as the map frame in the layout and a text string can be placed accordingly. Use CInt(x) to turn the value into a integer and whack into the layout.
 
The only annoying thing that i don't understand is how to make a window active without altering any of its settings or by using the user to clcik on it. ArcView's avenue had SetActiveDocument and i'm looking for a compromise statement.
 
regards,
andrew bailey
gis officer
london borough of hackney

Reply via email to