User Guide Notices Copyright
Total Page:16
File Type:pdf, Size:1020Kb
MapBasic Version 15.0 User Guide Notices Copyright 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. © 2015 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.pb.com/contact-us. © 2015 Adobe Systems Incorporated. All rights reserved. Adobe, the Adobe logo, Acrobat and the Adobe PDF logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. © 2015 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, © 2015 Silicon Graphics Inc. All Rights Reserved. libgeotiff © 2015 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-2015. All Rights Reserved. Portions © 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen. All Rights Reserved. ECW by ERDAS © 1993-2015 Intergraph Corporation, part of Hexagon Group and/or its suppliers. All rights reserved. Portions © 2015 Intergraph Corporation, part of Hexagon Group 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 & copyright treaties and foreign patent applications are pending. Unauthorized use or duplication prohibited. Contains FME® Objects © 2005-2015 Safe Software Inc., All Rights Reserved. Amyuni PDF Converter © 2000-2015, AMYUNI Consultants – AMYUNI Technologies. All rights reserved. Civic England - Public Sector Symbols Copyright © 2015 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 15.0 User Guide 3 Copyright © 2006-2015 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 © 2015 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 15.0 User Guide 4 Table of Contents Expressions 52 Looping, Branching, and Other Flow-Control 66 1 - Getting Started Procedures 71 Procedures That Act As System Event What's New 9 Handlers 75 System Requirements 9 Tips for Handler Procedures 78 Installing the MapBasic Development Compiler Instructions 80 Environment 10 Program Organization 82 MapBasic File Names and File Types 10 MapBasic Documentation Set 13 Conventions Used in This Manual 14 5 - Debugging and Trapping Getting Technical Support 15 Runtime Errors 2 - A Quick Look at MapBasic Runtime Error Behavior 85 Debugging a MapBasic Program 85 Getting Started 19 Error Trapping 87 What Are the Key Features of MapBasic? 21 How Do I Learn MapBasic? 22 6 - Creating the User Interface The MapBasic Window in MapInfo Pro 23 Introduction to MapBasic User Interface 3 - Using the Development Principles 91 Event-Driven Programming 91 Environment Menus 93 Standard Dialog Boxes 105 Introduction to MapBasic Development Custom Dialog Boxes 107 Environment 26 Windows 116 Editing Your Program 26 ButtonPads (Toolbars) 129 Compiling Your Program 30 Cursors 138 Linking Multiple Modules Into a Single Project 33 Integrating Your Application Into MapInfo Pro 139 Menu Summary in MapBasic Development Loading Applications Through the Startup Environment 37 Workspace 140 New MapBasic IDE features 41 Manipulating Workspaces through MapBasic 141 4 - MapBasic Fundamentals General Notes on MapBasic Syntax 45 Using the "Obj" Column 190 Querying An Object's Attributes 192 7 - Getting Started with the Creating New Objects 200 Ribbon Interface (MapInfo Pro Creating Objects Based On Existing Objects 203 Modifying Objects 206 64-bit) Working With Map Labels 208 Coordinates and Units of Measure 212 Ribbon 145 Advanced Geographic Queries 215 Status Bar 146 Mini Toolbar 146 User Control 147 11 - Advanced Features of Context Menu 147 Microsoft Windows BackStage 148 Declaring and Calling Dynamic Link Libraries 8 - Working With Tables (DLLs) 222 Creating Custom Button Icons and Draw Opening Tables Through MapBasic 151 Cursors 227 Reading Row-And-Column Values From a Inter-Application Communication Using DDE 230 Table 153 Incorporating Windows Help Into Your Writing Row-And-Column Values to a Table 159 Application 236 Creating New Tables 159 Accessing the Cosmetic Layer 164 12 - Integrated Mapping Accessing Classic Layout Windows 164 Multi-User Editing 165 What Does Integrated Mapping Look Like? 239 Files that Make Up a Table 169 Conceptual Overview of Integrated Mapping 240 Raster Image Tables 170 Technical Overview of Integrated Mapping 241 Working With Metadata 171 A Short Sample Program: "Hello, (Map of) Working With Seamless Tables 174 World" 242 Accessing DBMS Data 176 A Closer Look at Integrated Mapping 242 Accessing/Updating Remote Databases with Linked Using Callbacks to Retrieve Info from MapInfo Tables 179 Pro 252 Performance Tips for Table Manipulation 180 Alternatives to Using OLE Callbacks 257 Related MapBasic Statements and Functions 259 9 - File Input/Output OLE Automation Object Models 261 MapInfo Pro Command-Line Arguments 278 Overview of File Input/Output 184 Adding Toolbar Buttons and Handlers 283 Sequential File I/O 186 Learning More 287 Platform-Specific & International Character Sets 188 13 - Integrated Mapping (MapInfo Pro 64-bit) 10 - Graphical Objects What Does Integrated Mapping Look Like? 289 Using Object Variables 190 MapBasic 15.0 User Guide 6 Conceptual Overview of Integrated Mapping 290 Technical Overview of Integrated Mapping 291 Prerequisites for Storing/Retrieving Spatial A Short Sample Program: "Hello, (Map of) Data 347 World" 291 Appendix E: Manually Creating a A Closer Look at Integrated Mapping 293 MapInfo_MapCatalog 14 - Working with .Net Manually Creating a MapInfo_MapCatalog 349 Manually Making a Remote Table Mappable 351 Appendix F: Glossary Introduction and Requirements for .Net Programming 299 Definition of Terms 355 Getting Started 299 List of Embedded images in MapInfo Pro Style Working with Structures in .Net 305 Resources (MapInfo Pro 64-bit) 367 Exception Handling 309 Working with the GAC 310 Controlling MapInfo Pro from Within a .Net Method 311 Integrated Mapping in .Net 313 Appendix A: Sample Programs Samples\Delphi Directory 320 Samples\DLLEXAMP Directory 320 Samples\DotNet Directory 320 Samples\MapBasic Directory 321 Samples\MFC Directory 328 Samples\PwrBldr Directory 328 Samples\VB4 Directory 328 Samples\VB6 Directory 329 Samples\RIBBONINTERFACE\DotNet Directory 329 Samples\RIBBONINTERFACE\MapBasic Directory 333 Appendix B: Summary of Operators Numeric Operators 336 Comparison Operators 337 Logical Operators 338 Geographic Operators 339 Precedence 340 Automatic Type Conversions 342 Appendix C: Supported Table Types Supported ODBC Table Types 345 Appendix D: Making a Remote Table Mappable MapBasic 15.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