MapInfo Pro

 View Only
  • 1.  MapBasic v 17.0.3 (64-bit) - altering text in Layout Legend Frames in MapInfo Pro v 17.0.3 (64-bit)

    Posted 08-20-2019 11:01
    I'm trialling MapInfo v 17.0.3 and needing to re-write some of our MapBasic tools. I don't know MapBasic so mainly need to copy and paste from the MapBasic window.

    We have been using an in-house tool with MapInfo v15 and earlier which runs a search on several layers, styles a map with the results and creates a Legend Designer which we could then insert into a Layout frame.  Now, because the new Layout Designer does not take in old Legend Designer windows as frames, I want to make a new tool which, after we open our Layout workspace (which includes 2 map frames and 2 text frames), creates Legend Frames for all the map layers and then amends the text in each Legend Frame so that we have the standard legend back.

    I have managed to get as far as creating the Legend Frames, but I am failing to alter the Legend Frame text. I have looked here
    http://support.pitneybowes.com/SearchArticles/VFP05_KnowledgeWithSidebarHowTo?id=kA180000000Xg0MCAS&popup=false;&lang=en_US
    but I think this only applies to Text Frames, not Legend Frames.

    The text for the Legend Frame creation, which works, is:
    Create Designer Legend Portrait Default Frame Title "#" Font ("Arial",0,8,0) Default Frame Region Height 11 Units "pt" Frame From Layer 1 Frame 
    etc.

    I then have:
    Alter Designer Frame Id 1 Title "Data Enquiry" Font ("Arial", 0, 10, 0)
    Alter Designer Frame Id 1 Style Font("Arial", 0, 7, 0) ID 1 Text "Search Point" ID 2 Text "Search Area"
    etc.

    This is taken from the MapBasic window (apart from removing window ids like Window 3051), but when I run this from the mbx, nothing happens - the text isn't changed.

    Am I using the wrong terms, or is it something to do with the Frame Ids?

    Any help would be greatly appreciated,
    Many thanks,
    Jane

    ------------------------------
    Jane Mason
    Biological Records Officer (GIS), Suffolk Biodiversity Information Service, UK
    ------------------------------


  • 2.  RE: MapBasic v 17.0.3 (64-bit) - altering text in Layout Legend Frames in MapInfo Pro v 17.0.3 (64-bit)

    Posted 08-21-2019 19:40
    Perhaps it's applying it to the wrong window, since you're removing the window id clause?

    You can grab the ID of the newly created legend window using WindowID(0), e.g.

    Create Designer Legend .....
    Alter Designer Frame Window WindowID(0) Id 1 Title....

    Or you can store the ID in an integer variable if you need to use it later etc.

    ------------------------------
    Timothy Mashford
    Melbourne, Australia
    ------------------------------



  • 3.  RE: MapBasic v 17.0.3 (64-bit) - altering text in Layout Legend Frames in MapInfo Pro v 17.0.3 (64-bit)

    Employee
    Posted 08-22-2019 02:06
    I think we have solved the problem in the MapInfo Pro Developers Community.

    Basically, MapInfo Pro doesn't currently allow any expressions for layers with a style override, not even a static text. We have written up a fix to at least allow static texts in these cases.

    The solution seems to be to use the friendly name of the layers as they can be reflected in the legend using "#".

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 4.  RE: MapBasic v 17.0.3 (64-bit) - altering text in Layout Legend Frames in MapInfo Pro v 17.0.3 (64-bit)

    Posted 08-22-2019 10:34
    Thanks for your post Timothy - I think the window ID is the issue.  There is more on this in the Developers Community, as Peter says below.

    ------------------------------
    Jane Mason
    Biological Records Officer (GIS), Suffolk Biodiversity Information Service, UK
    ------------------------------



  • 5.  RE: MapBasic v 17.0.3 (64-bit) - altering text in Layout Legend Frames in MapInfo Pro v 17.0.3 (64-bit)

    Posted 09-09-2019 04:04
    Many thanks again Tim - I have solved the last part of my problem using this suggestion - I've given the details in the  MapInfo Pro Developers Community.

    ------------------------------
    Jane Mason
    Biological Records Officer (GIS), Suffolk Biodiversity Information Service, UK
    ------------------------------



  • 6.  RE: MapBasic v 17.0.3 (64-bit) - altering text in Layout Legend Frames in MapInfo Pro v 17.0.3 (64-bit)

    Posted 10-04-2019 06:51
    Just to add to this - there is an embarrassingly simple solution.  My error was in trying to add the map window and legend into our existing layout (opened as a workspace) frame.  You don't need to, as now you can add your map window into a blank Layout (under the Map dropdown), and it will come in in its own frame - and bring the individual legend frames from the Legend Designer too!  You can then move these about as you want.  I didn't realize that - I assumed that, as before, you need to have an existing frame to add a map window into (didn't spend enough time reading the documentation perhaps...……….).  

    So now, I can open our existing Layout workspace, just delete the existing frame I used to add the map window into, and then go to the Map dropdown and add the map window - lo and behold it brings the map in its frame and all the individual legend frames with it!  The map frame needs re-sizing a bit and the legend frames re-positioning, but no problem.

    ------------------------------
    Jane Mason
    Biological Records Officer (GIS), Suffolk Biodiversity Information Service, UK
    ------------------------------