Mapinfo Mapbasic V17.0 User Guide
Total Page:16
File Type:pdf, Size:1020Kb
MapBasic Version 17.0 User Guide Notices Copyright © April 2018 Pitney Bowes Software Inc. Information in this document is subject to change without notice and does not represent a commitment on the part of the vendor or its representatives. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, without the written permission of Pitney Bowes Software Inc., One Global View, Troy, New York 12180-8399. © 2018 Pitney Bowes Software Inc. All rights reserved. Pitney Bowes Software Inc. is a wholly owned subsidiary of Pitney Bowes Inc. Pitney Bowes, the corporate logo, MapInfo, Group 1 Software, and MapBasic are trademarks of Pitney Bowes Software Inc. All other marks and trademarks are property of their respective holders. Contact information for all Pitney Bowes Software Inc. offices is located at: http://www.pitneybowes.com/us/contact-us.html. © 2018 OpenStreetMap contributors, CC-BY-SA; see OpenStreetMap http://www.openstreetmap.org (license available at www.opendatacommons.org/licenses/odbl) and CC-BY-SA http://creativecommons.org/licenses/by-sa/2.0 libtiff © 1988-1997 Sam Leffler, © 2018 Silicon Graphics International, formerly Silicon Graphics Inc. All Rights Reserved. libgeotiff © 2018 Niles D. Ritter. Amigo, Portions © 1999 Three D Graphics, Inc. All Rights Reserved. Halo Image Library © 1993 Media Cybernetics Inc. All Rights Reserved. Portions thereof LEAD Technologies, Inc. © 1991-2018. All Rights Reserved. Portions © 1993-2018 Ken Martin, Will Schroeder, Bill Lorensen. All Rights Reserved. ECW by ERDAS © 1993-2018 Intergraph Corporation, part of Hexagon Geospatial AB and/or its suppliers. All rights reserved. Portions © 2018 Intergraph Corporation, part of Hexagon Geospatial AB. All Rights Reserved. MrSID, MrSID Decompressor and the MrSID logo are trademarks of LizardTech, a Celartem company, used under license. Portions of this computer program are copyright © 1995-1998 LizardTech, A Celartem Company, and/or the University of California or are protected by US patent no. 5,710,835 and are used under license. All rights reserved. MrSID is protected under US and international patent and copyright treaties and foreign patent applications are pending. Unauthorized use or duplication prohibited. ® Contains FME Objects © 2005-2018 Safe Software Inc. All Rights Reserved. Amyuni PDF Converter © 2000-2018, AMYUNI Consultants – AMYUNI Technologies Inc. All rights reserved. Civic England - Public Sector Symbols Copyright © 2018 West London Alliance. The symbols may be used free of charge. For more information on these symbols, including how to obtain them for use in other applications, please visit the West London Alliance Web site at http://www.westlondonalliance.org MapBasic 17.0 User Guide 3 Copyright © 2006-2018 TomTom International BV. All Rights Reserved. This material is proprietary and the subject of copyright protection and other intellectual property rights owned or licensed to TomTom. The use of this material is subject to the terms of a license agreement. You will be held liable for any unauthorized copying or disclosure of this material. Microsoft Bing: All contents of the Bing service are Copyright © 2018 Microsoft Corporation and/or its suppliers, One Microsoft Way, Redmond, WA 98052, USA. All rights reserved. Microsoft or its suppliers own the title, copyright, and other intellectual property rights in the Bing service and content. Microsoft, Windows, Windows Live, Windows logo, MSN, MSN logo (butterfly), Bing, and other Microsoft products and services may also be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. This product contains 7-Zip, which is licensed under GNU Lesser General Public License, Version 3, 29 June 2007 with the unRAR restriction. The license can be downloaded from http://www.7-zip.org/license.txt. The GNU License may be downloaded from http://www.gnu.org/licenses/lgpl.html. The source code is available from http://www.7-zip.org. Products named herein may be trademarks of their respective manufacturers and are hereby recognized. Trademarked names are used editorially, to the benefit of the trademark owner, with no intent to infringe on the trademark. MapBasic 17.0 User Guide 4 Table of Contents Expressions 55 Looping, Branching, and Other Flow-Control 70 1 - Getting Started Procedures 75 Procedures That Act As System Event What's New 9 Handlers 79 System Requirements 9 Tips for Handler Procedures 83 Installing the MapBasic Development Compiler Instructions 85 Environment 10 Program Organization 87 MapBasic File Names and File Types 10 MapBasic Documentation Set 13 Conventions Used in This Manual 15 5 - Debugging and Trapping Getting Technical Support 16 Runtime Errors 2 - A Quick Look at MapBasic Runtime Error Behavior 89 Debugging a MapBasic Program 89 Error Trapping 91 Getting Started 20 What Are the Key Features of MapBasic? 22 How Do I Learn MapBasic? 23 6 - Creating the User Interface The MapBasic Window in MapInfo Pro 24 Introduction to MapBasic User Interface 3 - Using the Development Principles 95 Event-Driven Programming 95 Environment Menus 97 Standard Dialog Boxes 110 Introduction to MapBasic Development Custom Dialog Boxes 112 Environment 27 Windows 122 Editing Your Program 27 ButtonPads (Toolbars) 136 Compiling Your Program 31 Cursors 145 Linking Multiple Modules Into a Single Project 34 Integrating Your Application Into MapInfo Pro 146 Menu Summary for the Development Loading Applications Through the Startup Environment 39 Workspace 147 MapBasic IDE Features 44 Manipulating Workspaces through MapBasic 147 4 - MapBasic Fundamentals General Notes on MapBasic Syntax 47 7 - Getting Started with the 10 - Graphical Objects Ribbon Interface (MapInfo Pro Using Object Variables 205 64-bit) Using the "Obj" Column 205 Querying An Object's Attributes 207 Ribbon 152 Creating New Objects 216 Status Bar 153 Creating Objects Based On Existing Objects 219 Mini Toolbar 153 Modifying Objects 221 User Control 154 Working With Map Labels 224 Context Menu 154 Coordinates and Units of Measure 228 BackStage 155 Advanced Geographic Queries 230 8 - Working With Tables 11 - Advanced Features of Microsoft Windows Opening Tables Through MapBasic 158 Reading Row-And-Column Values From a Declaring and Calling Dynamic Link Libraries Table 160 (DLLs) 238 Writing Row-And-Column Values to a Table 166 Creating Custom Button Icons and Draw Creating New Tables 166 Cursors 244 Accessing the Cosmetic Layer 171 Inter-Application Communication Using DDE 246 Accessing Classic Layout Windows 172 Incorporating Windows Help Into Your Multi-User Editing 173 Application 252 Files that Make Up a Table 177 Raster Image Tables 177 Working With Metadata 179 12 - Integrated Mapping Working With Seamless Tables 182 Working With Data in a GeoPackage 184 What Does Integrated Mapping Look Like? 255 Accessing DBMS Data 188 Conceptual Overview of Integrated Mapping 256 Accessing/Updating Remote Databases with Linked Technical Overview of Integrated Mapping 257 Tables 191 A Short Sample Program: "Hello, (Map of) Using Data Files in Any Language or Character World" 257 Set 193 A Closer Look at Integrated Mapping 259 Performance Tips for Table Manipulation 194 OLE Automation Support 263 MapInfo Pro Command-Line Arguments 263 9 - File Input/Output 13 - Working with .Net Overview of File Input/Output 198 Sequential File I/O 200 Introduction and Requirements for .Net Platform-Specific & International Character Programming 267 Sets 202 Getting Started 267 Working with Structures in .Net 273 MapBasic 17.0 User Guide 6 Exception Handling 277 Working with the GAC 278 Controlling MapInfo Pro from Within a .Net Method 279 Integrated Mapping in .Net 281 Appendix A: Sample Programs Samples\DotNet Directory 288 Samples\MapBasic Directory 288 Samples\RIBBONINTERFACE\DotNet Directory 294 Samples\RIBBONINTERFACE\MapBasic Directory 301 Appendix B: Summary of Operators Numeric Operators 304 Comparison Operators 305 Logical Operators 306 Geographic Operators 307 Precedence 308 Automatic Type Conversions 310 Appendix C: Supported Table Types Supported ODBC Table Types 313 Appendix D: Making a Remote Table Mappable Prerequisites for Storing/Retrieving Spatial Data 315 Appendix E: Manually Creating a MapInfo_MapCatalog Manually Creating a MapInfo_MapCatalog 317 Manually Making a Remote Table Mappable 319 Appendix F: Glossary Definition of Terms 323 List of Embedded images in MapInfo Pro Style Resources (MapInfo Pro 64-bit) 338 MapBasic 17.0 User Guide 7 1 - Getting Started Welcome to the MapBasic Development Environment, the powerful, yet easy-to-use programming language that lets you customize and automate MapInfo® Pro. The following pages tell you what you need to know to install the MapBasic software. For information on the purpose and capabilities of MapBasic, see A Quick Look at MapBasic. In this section What's New 9 System Requirements 9 Installing the MapBasic Development Environment 10 MapBasic File Names and File Types 10 MapBasic Documentation Set 13 Conventions Used in This Manual 15 Getting Technical Support 16 Getting Started What's New New in this release of MapBasic: • Added new and updated existing functions and statements, see New and Enhanced MapBasic Statements and Functions in the MapBasic Reference or MapBasic Help. • Added more command-line options to MapInfo Pro Command-Line Arguments: noautoload, embedding, d, l, activatelicense, borrowlicense, licensetransfer, and returnlicense. • MapInfo Pro now supports