Академический Документы
Профессиональный Документы
Культура Документы
( )
MapInfo Corporation
Troy, New York
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 MapInfo
Corporation, One Global View, Troy, New York 121808399.
1992-2000 MapInfo Corporation. All rights reserved. MapInfo Help 1992-2000 MapInfo Corporation. All rights
reserved.
. 2000 , , . .
. 2000 . .
MapInfo, MapInfo Professional, MapBasic, and the MapInfo Logo are registered trademarks of MapInfo
Corporation. Contact MapInfo Corporation on the Internet at: http://www.mapinfo.com.
MapInfo Corporate Headquarters:
Germany:
Voice:
(518) 2856000
Voice:
Voice:
Fax:
(518) 2856060
Fax:
Fax:
email:
uk@mapinfo.com
email: germany@mapinfo.com
1: ........................................................................................... 1
......................................................................................... 2
MapBasic ........................................................................................... 3
MapBasic................................................... 3
............................................................................... 5
2: MapBasic ...................................................................... 7
MapBasic?.................................................................. 8
MapBasic ....................................................................10
MapBasic?....................................................................................12
3: .................. 15
MapBasic ............................................................16
.............................................................16
.......................................................................................18
: ..................................................20
MapBasic......................................................24
4: MapBasic ................................................................. 29
MapBasic ........................................................30
....................................................................................................32
.....................................................................................................37
................................................................46
......................................................................................................51
- .............................................................53
- ..................56
, ......................................................................58
....................................................................................59
.......................................................................................61
5: .......................................................... 63
....................................................................................64
MapBasic ....................................................................64
............................................................................................66
6: ................................................................ 69
.......................................................................70
..........................................................................71
............................................................................................................73
.............................................................................81
......................................................................................85
.............................................................................................................94
................................................................................ 101
MapInfo ...................................................................... 109
.................................................. 111
7: ...................................................................... 113
MapBasic ................................................................. 114
MapInfo ............................................. 117
........................................................ 118
................................................................................ 122
.................................................................................... 123
........................................................................... 124
Selection ............................................................................... 126
CosmeticN" ................................ 128
LayoutN".............................................. 129
..................................................... 130
- ............................................................................ 134
, ....................................................... 135
..................................................................................... 137
........................................................................... 140
............................................................................. 142
.............. 144
............................................................ 144
................... 145
8: / .................................................................... 147
/........................................................................... 147
...................................................................... 149
........................................................................... 151
............................................................................................ 151
......................................................................................... 152
, / ................................... 153
9: ................................................................... 155
Object ................................................................................... 156
Obj"................................................................................... 156
.......................................................................... 158
................................................................................. 163
............................................ 166
........................................................................................ 167
......................................................................................... 169
...................................................................... 173
................................................................................... 176
II
DDE................................................. 200
........................................... 206
: .................................................... 251
B: TEXTBOX.............................................. 255
C: MapBasic 6.0 ............................................. 271
D: ODBC........................................ 273
E: .................. 275
........................................................................................................ 277
III
1:
MapBasic 6.0,
,
MapInfo Professional.
MapBasic.
MapBasic 2: " MapBasic".
. . .
...................................................................3
MapBasic.....................................................................3
MapBasic ............................3
.........................................................5
1:
MapBasic Windows,
:
, Windows.
, Windows.
45 b
, MapBasic, Mapinfo
Professional.
, MapBasic 5.5/6.0, MapInfo 4.0.
C :
MapBasic 6.0.
1:
MapBasic
MapBasic:
1. MapInfo Pro CD .
MapBasic\Disk1 setup.exe.
2. , .
MapBasic MapInfo (..
C:\MAPINFO\MAPBASIC\MAPBASIC.EXE).
!
MapInfo
Corporation, .
:
.
MapBasic,
.
MapBasic
MapBasic,
MapBasic.
Mapbasic.exe
MapBasic
MapBasic
:
ERRORS.DOC: MapBasic;
MAPBASIC.EXE: , MapBasic;
MAPBASIC.DEF: , ;
MENU.DEF: , ,
MapInfo;
ICONS.DEF: , ,
MapInfo;
MAPBASIC.H: C/C++;
3
1:
MAPBASIC.DEF;
MAPBASIC.BAS: Visual Basic;
MAPBASIC.DEF;
MAPBASIC.HLP: MapBasic;
_.MB, _.MBP: -; .
.
MapBasic :
_.MB: ( MapBasic);
_.MBX: () ;
_.MBP: ( ,
);
_.MBO: (
);
_.ERR:
, .
1:
, ,
, . :
Note MapBasic
.
:
, , . ,
MapBasic .MB.
( MapInfo). MapBasic
, . ,
MapBasic, .MBX (MapBasic eXecutable).
, , .
, , .
, MapBasic.
, MapBasic Select
.
Courier MapBasic:
Note " MapBasic-!"
MapBasic:
Stop .
MapBasic
. ,
. ,
.
MapBasic
"" (>), :
> , .
> " " ".
.
MapBasic
2: MapBasic
MapBasic , ,
MapInfo.
. . .
MapBasic?........................................... 8
MapBasic ............................................. 10
MapBasic? ............................................................ 12
2: MapBasic
MapBasic?
MapBasic .
MapBasic.
C :
, . (
, MapBasic. . 3 "
").
MapBasic. , " (.. ,
MapInfo).
MapBasic (linker). ,
, ""
.
MapBasic,
MapBasic.
, MapBasic
BASIC. MapBasic
BASIC, MapBasic BASIC,
(, Microsoft QBasic). BASIC,
QBasic MapBasic, , BASIC.
BASICe
MapBasic
20
GOSUB 3000
Call heck_Status(quit_time)
30
40
FOR X = 1 TO 10
For x = 1 To 10
50
GOSUB 4000
Call Process_batch(x)
60
NEXT X
Next
80
GOTO 30
Loop
MapBasic MapInfo.
MapBasic;
MapInfo . , MapBasic
; MapInfo.
2: MapBasic
, MapBasic ; MapBasic
, 300 . ,
MapBasic MapInfo,
MapInfo.
MapBasic-?
3 " "
MapBasic. ,
:
1. MapBasic.
2. > , .
3. MapBasic . ,
: Note " MapBasic-!"
4. > , .
, , WELCOME.MB (
MapBasic .MB).
: .
5. > . MapBasic
(WELCOME.MB)
(WELCOME.MBX).
6. MapInfo.
7. > MapBasic. MapInfo
, .
WELCOME.MBX, MapInfo ,
" MapBasic-!".
, MapBasic. , , ; ,
, , .
, 3 "
".
2: MapBasic
MapBasic
MapBasic MapInfo
MapBasic MapInfo.
MapBasic MapInfo,
MapInfo .
, MapBasic ,
.
MapBasic MapInfo
MapBasic ,
"" MapInfo. ,
MapInfo ( ).
"" ,
. MapBasic
.
MapBasic
. , MapBasic Select (
Select SQL-) ,
, ,
.
MapBasic.
MapBasic, Select Update, ,
,
.
MapBasic
, MapBasic,
, MapInfo. ,
MapBasic MapInfo Windows, MapInfo Macintosh.
, , .
, ,
, Mac Windows.
10
2: MapBasic
,
. ,
(, DDE-,
Microsoft Windows, Apple Events, Macintosh). 10 " "
.
MapBasic MapInfo
MapBasic
. MapBasic
.
MapBasic
(Dynamic Data Exchange DDE) , Visual Basic. MapBasic
Windows (Dynamic Link Library DLL).
DLL-, C . ,
MapBasic, Macintosh,
Apple Events, XCMD XFCN.
(Integrated Mapping) MapBasic,
MapInfo , ,
Visual Basic. 12.
11
2: MapBasic
MapBasic?
MapBasic MapInfo,
MapInfo , MapBasic.
, MapInfo,
, , .
MapInfo, MapBasic
.
MapBasic
MapBasic.
MapBasic ,
MapBasic.
MapBasic
; , 6
( ), 8 /.
4 " MapBasic ".
MapBasic
MapBasic. MapBasic,
- .
,
. MapBasic
.
1.
: MapBasic
TEXTBOX.MB. , MapBasic.
TEXTBOX.MB B.
MapInfo
MapInfo
.
, ,
MapBasic. MapBasic
. , ,
MapInfo MapBasic.
12
2: MapBasic
, , MapBasic,
.
MapInfo .
MapBasic,
. ,
, MapBasic.
MapBasic
(Help).
. , MapBasic.
:
F1.
, .
,
.
MapBasic,
. Windows. ; "
" MapBasic. "", ALT+TAB.
"" , "Always
on Top" (" ") .
MapBasic MapInfo
MapInfo , MapBasic.
MapBasic.
:
1. MapInfo.
2. > MapBasic.
MapBasic. MapInfo,
MapBasic MapBasic.
, MapInfo "" MapBasic ,
MapBasic.
13
2: MapBasic
MapBasic (
). , MapBasic, MapBasic; ,
MapBasic MapInfo, "".
(, For...Next).
MapBasic . . 5.
,
MapBasic,
MapInfo .
MapBasic
, , ,
.
, .
.
14
3:
MapBasic ,
. ( /
//) . ,
(, , "")
. .
: MapBasic, MapBasic
MapBasic .
. . .
......................... 15
MapBasic..................................... 16
..................................... 16
............................................................... 18
: .......................... 20
MapBasic............................... 24
3:
MapBasic
MapBasic
, MapBasic.
, , , ,
,
, MapBasic.
Windows,
MapBasic. :
, , ;
, , , . ,
MapBasic (, ).
MapBasic, , MapBasic.
(
) ( ).
. ,
MapBasic:
Note " MapBasic!"
, .
, , WELCOME.MB.
: MapBasic .MB .
WELCOME,
WELCOME.MB.
MapBasic ,
.
,
MapBasic. ;
, , ..
.
16
HOME / END
CTRL+HOME / CTRL+END
CTRL+ / CTRL+
CTRL+T
CTRL+O
CTRL+
CTRL+
CTRL+
CTRL+
CTRL+
3:
CTRL+
CTRL+
CTRL+DEL
DEL
CTRL+
CTRL+
CTRL+
(
)
.
CTRL+
CTRL+K
CTRL+
Next Error; ,
,
MapInfo,
CTRL+
CTRL+
F1
. :
F1, ,
.
F8
CTRL+F4
ALT+F4
MapBasic
SHIFT+F4
SHIFT+F5
(
)
.
, ,
.
(
)
( 32 ).
.
( CTRL
, ).
: MapBasic .
.
(, F1).
1. , .
17
3:
2. , ,
.
, . ,
.
:
. MapBasic ,
"", . ,
,
.
MapBasic .
, MapBasic
.
,
. , .
:
, MapBasic , .
, .
, MapBasic ,
.
, MapBasic MBX- (MapBasic
eXecutable). .MBX-
( , , ). ,
MapBasic, ,
.MBX ( .MB).
18
3:
,
,
MapBasic. , MapBasic
,
( STATES TATES):
Open Table "STATES"
Map From TATES
MapBasic .
; ,
. , MapInfo
Map From TATES. MapInfo
(, TATES "),
, TATES.
,
MapInfo. "" MapBasic (.MBX), .
MapBasic:
. MapBasic
MapInfo , MapInfo .
MapBasic
- ,
MapBasic.
.
, , .
, .
Save As Save. ,
,
.
,
MapBasic
. MapBasic
: .
,
.
, MapBasic.
MapBasic
, . , MapBasic
.ERR. ,
DISPATCH.MB, MapBasic
DISPATCH.ERR. , > .
19
3:
MapBasic,
MapBasic ,
.
,
, .
MapBasic :
mapbasic
-D,
, MapBasic .
, MapBasic
(Main Sub1):
mapbasic
-D
main.mb
sub1.mb
-L,
, MapBasic .
( .)
, TextBox:
mapbasic
-L
tbproj.mbp
-D -L , :
mapbasic
-D
textbox.mb
-L tbproj.mbp
MapBasic , -D -L
, MapBasic
.
:
MapBasic?
,
() MapBasic.
,
. .
;
(). .
, .
MapBasic, .
. ,
.
MapBasic ,
.
20
. ,
.
.
3:
, 64
MapBasic.
. ,
, ("")
.
.
,
,
. ,
, ,
.
TextBox (tbproj.mbp) :
[Link]
Application=textbox.mbx
Module=textbox.mbo
Module=auto_lib.mbo
SCALEBAR (SBPROJ.MBP):
[Link]
Application=scalebar.mbx
Module=scalebar.mbo
Module=auto_lib.mbo
, MapBasic
AUTO_LIB. AUTO_LIB ,
MapBasic.
MapBasic- AUTO_LIB, About
AutoLoad..." ("").
"AutoLoad" ,
, MapInfo.
, MapBasic
MapInfo.
MapBasic,
AUTO_LIB.MB.
,
:
1. > , .
2. :
[Link]
3. Application=appfilename ( appfilename
). :
21
3:
Application=C:\MB\CODE\CUSTOM.MBX
4. Module=modulename ( modulename
MapBasic). :
Module=C:\MB\CODE\CUSTOM.MBO
,
:
1. , .
> , > .
, >
.
2. > , ,
MapBasic . " "
(.MBP") OK.
. ,
MapBasic, ,
> .
.
: ,
, > . ,
> .
3. , > . MapBasic
(.MBO),
. , MapBasic
(.MBX) . , MapBasic
.
22
3:
,
, > .
, MapBasic, ,
, , C.
MapBasic .
.
.
1. > .
2. .
3. SHIFT CTRL
. SHIFT ,
CTRL , .
,
. , TEXTBOX.MB HandleInstallation,
AUTO_LIB.
() . TEXTBOX.MB
HandleInstallation, HandleInstallation TEXTBOX.MB.
MapBasic ,
Declare Sub. ,
Declare Function. Declare
() .
TEXTBOX.MB Include AUTO_LIB.DEF".
AUTO_LIB.DEF Declare Sub Declare Function,
AUTO_LIB. TEXTBOX.MB
AUTO_LIB.DEF, MapBasic HandleInstallation
( sub-").
()
,
:
Global (, GLOBALS.DEF").
Include ,
.
, AUTO_LIB.DEF
String (): gsAppfilename gsAppDescription.
AUTO_LIB.MB TEXTBOX.MB :
Include "auto_lib.def"
23
3:
, .
TEXTBOX.MB ,
AUTO_LIB.MB .
DDE ( 11).
Dim,
. Dim .
(.. .MB-) .
.
,
,
(, -
).
MapBasic
, , , ,
MapBasic, .
, .
MapBasic
(., DISPATCH.MB), (DISPATCH.ERR)
(, MAPINFOW.WOR). ,
MapBasic.
:
. SHIFT
CTRL.
: MapBasic 64K
. MapBasic.
"
MapBasic".
. ,
MapBasic : , .
, .
. , MapBasic
, .
, .
.
, - .
.
, .
24
3:
,
.
, - .
.MB-,
, . (
,
.)
, .
, ,
_.ERR.
, > .
. (
, .)
(, ).
.
, .
MapBasic. MapBasic ,
.
, MapBasic.
.
MapBasic ,
.
.
,
.
(Clipboard),
. (Clipboard)
(. ).
, .
(Clipboard),
.
, .
(Clipboard)
, .
,
.
,
.
.
, .
.
, .
25
3:
,
, .
.
, .
: ,
, " " ( "").
, "
".
"". MapBasic .
, MapBasic ,
. , MapBasic .
:
" " , ,
"", " ". MapBasic
"" " ". ,
, .
:
1. > . " ".
2. "" " ".
3. "".
MapBasic .
, Ctrl+ (
).
, Ctrl+
( ).
, Ctrl+ Ctrl+
.
.
,
.
.
.
, MapBasic
.
, .
,
.
26
3:
,
, .
, .
.
, ,
.
, , .
, MapBasic
.
, .
MapBasic,
.
,
. ,
, .
,
.
() .
, .
, MapBasic
. ,
MapBasic MBX- ( ,
) (MBO) .
,
(
).
, .
MapInfo ,
.
MapInfo, .
.
, .
/
. ,
. ,
.
/ , ,
.
MapBasic , ,
.
27
3:
, .
, .
().
,
. ,
.
Macintosh.
, .
.
.
(.. ), .
().
MapBasic. ,
.
"Contents" (),
,
( "Search" ("")).
"Search" ("").
, .
MapBasic " MapBasic",
.
: .
, .
Edit > Copy ( > )
.
28
MapBasic
4: MapBasic
, MapBasic,
, MapBasic.
. . .
MapBasic.............................................................. 30
MapBasic................................. 32
............................................................................. 32
............................................................................. 37
........................................ 46
.............................................................................. 51
- .................................... 54
-
................................................................... 57
, ............................................... 58
............................................................. 59
............................................................... 61
4: MapBasic
MapBasic
MapBasic,
MapBasic.
MapBasic () ()
. -, ---.
:
MapBasic ();
() . ,
If Then ,
MapBasic, counter ,
.
If counter > 5 Then
Note " "
End If
MapBasic .
, If...Then :
If
counter = 55
Or counter = 34 Then
Note " "
End If
-, MAPBASIC.DEF
MapBasic ,
:
Include "mapbasic.def"
MAPBASIC.DEF ,
MapBasic. , ,
MAPBASIC.DEF, (, TRUE, FALSE, BLACK, WHITE,
CMD_INFO_X, OBJ_INFO_TYPE ..).
MapBasic -. :
If CommandInfo( CMD_INFO_DLG_OK ) Then
30
4: MapBasic
(, CMD_INFO_DLG_OK
), MAPBASIC.DEF
Include. ,
(, Field CMD_INFO_DLG_OK
").
MapBasic
MapInfo MapBasic.
MapBasic MapBasic. ,
MapBasic :
MapBasic MapBasic,
MapBasic. :
( If...Then, For...Next GoTo)
MapBasic.
, MapBasic,
MapBasic. ,
MapBasic, .
MapBasic MapInfo,
.
ENTER CTRL+ENTER. ,
, ENTER.
, MAPBASIC.DEF (., BLACK, WHITE
..) MapBasic.
(), MAPBASIC.DEF;
, BLACK 0. MapBasic
, ,
(.., , BLACK").
31
4: MapBasic
MapBasic
BASIC- .
MapBasic ,
(, Object;
MapBasic MapBasic,
Dim).
?
,
.
, .
(, counter, x, y2, customer_name).
MapBasic .
.
Dim.
, .
(=) , .
Integer,
23:
Dim counter As Integer
counter = 23
Dim , .
Dim :
Dim total_distance, longitude, latitude As Float
longitude = -73.55
latitude = 42.917
Dim .
Date String:
Dim start_date, end_date As Date,
first_name, last_name As String
32
31 .
.
, (_) (~).
, , (#)
(_).
4: MapBasic
: $, %, &, ! @.
BASIC- ;
MapBasic .
MapBasic .
, If, Then, Select, Open, Close
Count. Dim
MapBasic.
MapBasic :
SmallInt
-32767 32767; .
Integer
-2 2 ;
.
Float
;
IEEE.
String
( 32767 ).
String * n
n ( 32767 ).
Logical
TRUE FALSE.
Date
Object
; 9.
Alias
;
7.
Pen
; . 9.
Brush
; . 9.
Font
; . 9.
Symbol
; . 9.
MapBasic :
. 32767 .
,
Dim.
String ,
String. String ,
String (*)
. full_name
employee_id 9 :
Dim full_name As String,
employee_id As String * 9
33
4: MapBasic
: BASIC- , MapBasic
,
. , ,
ABC",
ABC " (.. ABC" ).
.
,
( ) .
. Dim
Date:
Dim
start_date(3+7) As Date
:
_(-)
, start_date:
start_date(1) = "6/11/93"
, ReDim. ,
, , - ,
,
ReDim.
UBound( ).
, name_list,
.
Dim counter As Integer, name_list(5) As String
...
counter = UBound(names)
'
ReDim names(counter + 10)
' 10
MapBasic :
MapBasic .
MapBasic 1; ,
names(1).
MapBasic,
MapInfo Windows, 7000 .
MapBasic (, MapInfo Windows 95, Windows
NT Macintosh) 32767 .
, ,
. 7
" ".
34
4: MapBasic
MapBasic ,
. .
, ( )
Type...End
Type.
. ,
Dim.
, , employee
(), employee.
Type employee
name As String
title As String
id As Integer
End Type
Dim manager, staff(10) As employee
.
employee : name, title id.
:
_._
manager:
manager.name = ""
manager.title = " "
manager.id = 111223333
() . ,
employee:
staff(1).name = ""
staff(1).title = ""
Type...End Type .
. , Type...End Type
.
Type ,
.
.
, Dim, .
, .
MapBasic ,
, .
Global. Global
Dim, Dim
Global. Global
Integer:
35
4: MapBasic
Global first_row, last_row As Integer
Global .
. , Global .
, ,
.
Declare Sub Main
Declare Sub initialize_globals
Global gx, gy As Float
'
' Float
Global start_date As Date '
' Date
Sub Main
Dim x, y, z As Float
'
' Main
Call initialize_globals
...
End Sub
Sub initialize_globals
gx = -1
gy = -1
start_date = CurDate()
'
'
'
'
'
'
GX
GY
START_DATE
End Sub
, ,
. MapBasic
, .
. Microsoft Windows
(Dynamic Data Exchange DDE)
MapBasic-; . 11.
,
. , , counter,
counter:
Declare Sub Main
Declare Sub setup
Global counter As Integer
...
Sub setup
Dim counter As Integer
counter = 0
...
End Sub
36
4: MapBasic
.
. counter = 0
counter.
, MapBasic
. , MapBasic
.
, MapBasic .
, ,
, MapBasic .
37
4: MapBasic
, .
, , ,
.
?
. :
counter = 23
counter , ,
23. 23 . ,
, .
( "):
Dim name As String
name = " "
:
( "
"), (, 23). , ,
" ," .
. " MapBasic".
?
(, +, *, >) (And, Or, Not ..),
(,
). , (+)
y + z. ( )
x:
Dim
y =
z =
x =
x, y, z
1.5
2.7
y + z
As Float
(+) ,
. (-),
; (*); (^).
.
.
full_name:
Dim first_name, last_name, middle_init, full_name As String
first_name = " "
middle_init = " "
last_name = ""
full_name = first_name + middle_init + last_name
38
4: MapBasic
'
' full_name
'
'
?
MapBasic .
, , Sqr( )
, UCase$( )
. ,
, - .
. , x ,
Minimum( ):
x = Minimum( y, z )
MapBasic ,
BASIC- . (, Minimum"
) . ,
. ,
( Minimum( ) ).
,
. ;
, , - .
: Dim x,
. Sqr( )
:
Dim x As Float
x = Sqr(2)
, CurDate( ),
Date, :
Dim today, yesterday As Date
today = CurDate( )
yesterday = today 1
CurDate( ) . MapBasic
,
, .
MapBasic BASIC- ,
Chr$( ) Sqr( ), ,
Area( ) Perimeter( ).
MapBasic
,
. "
."
39
4: MapBasic
:
. , 36 ;
, , Integer,
SmallInt Float. 86.4 .
: MapBasic 4.0
VisualBasic: &H ( - ).
1A (
26):
Dim i_num As Integer
i_num = &H1A
: . ,
:
counter = 1,250,000
' !
: . :
last_name = ""
256 .
,
. " "
(") ,
:
Dim prompt As String
prompt = " ""World"" ."
Print prompt
: :
(1), , (0), .
MapBasic TRUE FALSE; TRUE FALSE
, MAPBASIC.DEF.
TRUE FALSE,
Include MAPBASIC.DEF. :
Include "mapbasic.def"
Dim edits_pending As Logical
edits_pending = FALSE
-: - 8-
(YYYYMMDD), YYYY , MM- , DD -. , ,
5 1994:
d_startingdate = 199551231
- . :
d_endingdate = "12/31/95"
-, , 4
, :
d_endingdate = "12/31/1995"
d_endingdate = "12/31/95"
40
4: MapBasic
MapBasic , 20 , ..
19. , MapBasic ,
.
.
,
. //, 06/11/95
11 1995 , //, 6
.
, NumberToDate( ),
8- , .
, ,
, SetFormat. .
MapBasic MapBasic.
:
Windows 3.1 /
Windows 95
Regional Settings
Mac Date&Time
- : 7 "
". Alias .
:
Dim column_name As Alias
column_name = "City"
Integer
i = 1234567
SmallInt
m = 90
Float
f=4
size = 3.31
debt = 3.4e9
String
.
.
Chr$( ).
Logical
edits_pending = 1
1= , 0 =
MapBasic
41
4: MapBasic
edits_pending = TRUE
TRUE
FALSE.
Date
d_starting = 19940105
date_done = 3/23/88"
paiddate = 12-24-1993"
yesterday = CurDate( ) 1
Alias
col_name = Pop_1990"
col_name = COL1"
.
. 7.
Pen
Brush
Font
Symbol
Object
MapBasic . ,
Str$( ):
Dim q1, q2, q3, q4, total As Float, s_message As String
...
total = q1 + q2 + q3 + q4
s_message = " : " + Str$(total)
MapBasic
.
, ,
.
: .
.
42
x=a+b
x=ab
x=a*b
4: MapBasic
/
x=a/b
x=a\b
Mod
x = a Mod b
x=a^b
\ Mod . :
10 / 8
1.25
10 \ 8
10 Mod 8
1 ( 1.25)
2 ( 10 8)
(-) :
x = -23
: (+) ("") .
Note ": " + _ +
" "
+ _
(&) (+).
.
: (&)
(&). , , .
Like .
, ":
If
:
Integer:
CurDate( ) ,
:
Dim today, one_week_ago, tomorrow As Date,
days_elapsed As Integer
today = CurDate( )
tomorrow = today + 1
one_week_ago = today 7
' ,
' :
days_elapsed = today StringToDate("1/1")
43
4: MapBasic
: ( ,
) TRUE FALSE.
(, If...Then).
TRUE
If a = b Then ...
<>
<
>
<=
>=
Between...And...
If x Between f_low And
f_high Then...
, . ,
Object, Pen, Brush, Symbol Font.
Between...And... ,
. If...Then
Between...And...:
If
:
If
= , MapBasic
TRUE, . ,
; ,
If...Then (" ") :
Dim city_name As String
city_name = " "
If city_name = " " Then
Note " ."
End If
StringCompare( ), MapBasic.
:
. MapBasic
, .
. ,
44
4: MapBasic
,
.
,
RTrim$( ).
RTrim$( ) , .
:
TRUE FALSE:
TRUE,
And
Or
Not
If a And b Then...
If a Or b Then...
If Not a Then...
, If...Then :
x, , x, 10. ,
.
If x < 0 or x > 10
Then
Note " ."
End If
: Object
TRUE FALSE.
TRUE,
Contains
If a Contains b Then...
Contains Part
Contains Entire
Within
If a Within b Then...
Partly Within
Entirely Within
Intersects
If a Intersects b Then...
9.
45
4: MapBasic
MapBasic
, . ,
MapBasic
. , MapBasic ,
MapBasic.
:
x=2+3*4
. ,
.
( 2 + 3 5), (5 * 4),
20. , ,
, . , MapBasic
(3 * 4, 12), (2 + 12, 14).
MapBasic,
. ,
, :
x = (2 + 3) * 4
MapBasic.
:
, , Mod,
, , &
, , Like
Not
And
Or
, , .
.
,
, .
46
4: MapBasic
.
MapBasic :
MapBasic (, If...Then, GoTo).
(, For...Next, Do...While).
If...Then
If...Then MapBasic If...Then
. If...Then ;
, MapBasic ,
Then. MapBasic
reset_counter, :
If counter < 0 Then
Note ": ."
Call reset_counter
End If
If...Then Else. ,
MapBasic , Else,
, , Then.
Else.
If counter < 0 Then
Note ": ."
Call reset_counter
Else
Note " ."
End If
If...Then ElseIf.
ElseIf .
ElseIf ,
MapBasic ElseIf, :
If counter < 0 Then
Note ": ."
Call reset_counter
ElseIf counter > 100 Then
counter = 100
Note ": (100) ."
Else
Note " ."
End If
, ElseIf . If...Then
ElseIf, .
, ,
47
4: MapBasic
Do...Case (. ) If...Then
ElseIf.
Do Case
Do Case , ,
.
.
, .
(--),
". ,
,
..
Dim current_month, quarter As SmallInt,
report_title As String
current_month = Month( CurDate() )
'
' current_month 1,
' , 2 ..
'
Do Case current_month
Case 1, 2, 3
'
' 1 (), 2 () 3 (),
' .
' .
'
report_title = " "
quarter = 1
Case 4, 5, 6
report_title = " "
quarter = 2
Case 7, 8, 9
report_title = " "
quarter = 3
Case Else
'
' 1 9,
' .
'
report_title = " "
quarter = 4
End Case
48
4: MapBasic
GoTo
GoTo ,
GoTo. GoTo ; GoTo
, , ,
. ,
; (
GoTo ).
If counter < 0 Then
GoTo get_out
End If
...
get_out:
End Program
GoTo. ,
If...Then, GoTo.
GoTo.
For...Next
For...Next , .
, MapBasic , For
Next.
For...Next ,
.
. ( )
MapBasic ( ).
(1); ,
Step.
For...Next
:
Dim monthly_sales(12), grand_total As Float,
next_one As SmallInt
...
For next_one = 1 To 12
grand_total = grand_total + monthly_sales(next_one)
Next
For...Next, MapBasic -
; , MapBasic next_one
. MapBasic , Next.
MapBasic -.
( , next_one
12), MapBasic .
For...Next , Exit For.
.
49
4: MapBasic
: For...Next
(, For i = 0.1 to 1.0 Step 0.1), MapInfo
Macintosh , MapInfo Windows UNIX (..
Macintosh PC Windows). -
Macintosh.
For...Next . MapBasic.
Do...Loop
Do...Loop ,
, .
Do...Loop, ,
: ,
. :
Dim sales_total, new_accounts(10) As Float,
next_one As SmallInt
next_one = 1
Do
sales_total = sales_total + new_accounts(next_one)
next_one = next_one + 1
Loop While next_one <= UBound(new_accounts)
, ,
( ).
.
, .
, Do...Loop
.
Dim sales_total, new_accounts(10) As Float,
next_one As SmallInt
next_one = 1
Do While next_one <= UBound(new_accounts)
sales_total = sales_total + new_accounts(next_one)
next_one = next_one + 1
Loop
Do...Loop While;
,
. , Do...Loop
Until While. Do...Loop
Until, , .
Do...Loop , Exit Do.
.
While...Wend
MapBasic BASIC
While...Wend. While...Wend Do While...Loop.
50
4: MapBasic
BASIC,
While...Wend MapBasic. , , ,
Do...Loop While...Wend;
, Do...Loop Exit Do,
While...Wend .
While...Wend . MapBasic.
End Program MapBasic-,
, , .
End Program , (
Open File), .
End Program .
, , End Program.
, MapInfo ,
MapInfo,
. ,
End Program, End Program
.
6 " ".
MapInfo
End MapInfo MapBasic (,
End Program), MapInfo.
51
4: MapBasic
( )
MapBasic. MapBasic
; ,
.
, .
Main
MapBasic ,
Main. MapBasic,
Main .
Main. Main Note:
Declare Sub Main
Sub Main
Note " MapBasic!"
End Sub
MapBasic,
. Main, ,
, Main (
).
MapInfo Main
( , ).
Main Call.
, : Main
announce_date.
Declare Sub Main
Declare Sub announce_date
Sub Main
Call announce_date( )
End Sub
Sub announce_date
Note " " + Str$( CurDate() )
End Sub
52
4: MapBasic
,
BASIC- , MapBasic
. ,
Sub...End Sub.
, check_date (
Date). , ,
( 180 ); 180 ,
.
Declare Sub Main
Declare Sub check_date(last_date As Date)
Sub Main
Dim report_date As Date
report_date = "01/01/94"
Call check_date( report_date )
' report_date
' (
' check_date).
End Sub
Sub check_date(last_date As Date)
Dim elapsed_days As SmallInt
elapsed_days = CurDate() last_date
If elapsed_days > 180 Then
last_date = CurDate()
End If
End Sub
MapBasic .
:
Call , ,
.
, .
,
-.
, Call
Date report_date:
Call check_date( report_date )
check_date () last_date.
check_date last_date
(last_date = CurDate( ) ), MapBasic
report_date Main.
53
4: MapBasic
. ,
, ,
(, ).
BASIC- , MapBasic
. ,
, ByVal
Sub...End Sub.
:
Call ()
. Call ,
.
,
( ) . ,
.
(display_date_range),
Date, .
Declare Sub Main
Declare Sub display_date_range(ByVal start_date As Date,
ByVal end_date As Date )
Sub Main
Call display_date_range( "1/1", CurDate() )
End Sub
Sub display_date_range(ByVal start_date As Date,
ByVal end_date As Date )
Note " : " + Str$(start_date)
+ " " + Str$(end_date) + "."
End Sub
display_date_range .
, display_date_range Main:
Call display_date_range( "1/1", CurDate() )
. (1/1")
Date, ,
CurDate( ).
MapBasic . ,
MapBasic .
. ,
, MapInfo ;
, .
54
4: MapBasic
.
-
MapBasic
. Main, ,
MapBasic Main.
Main, MapBasic :
EndHandler, RemoteMsgHandler, SelChangedHandler, ToolHandler,
WinChangedHandler, WinClosedHandler WinFocusChangedHandler.
, MapBasic .
, MapBasic
.
?
(Graphical User Interface),
. ,
, .
; , ,
, ,
..
?
MapBasic,
.
,
. , ,
; , -
, .
MapBasic .
, MapBasic
.
.
6 " ".
, . ,
,
WinClosedHandler.
MapBasic. MapBasic.
55
4: MapBasic
( )
EndHandler
,
MapInfo. EndHandler
(,
).
ForegroundMsgHandler
, MapInfo .
RemoteMsgHandler
,
, .
SelChangedHandler
Selection.
Selection ,
SelChangedHandler ,
.
ToolHandler
,
, .
WinChangedHandler
,
.
,
WinChangedHandler ,
.
WinClosedHandler
, ,
, .
WinFocusChangedHandler
,
.
, Call.
, MapBasic
. ,
WinClosedHandler, MapBasic
WinClosedHandler ,
.
. ,
WinClosedHandler,
; SelChangedHandler,
Selection ..
56
4: MapBasic
,
ToolHandler. ,
Call. MapBasic ToolHandler
,
, .
Include "mapbasic.def"
Declare Sub Main
Declare Sub ToolHandler
Sub Main
Note " ToolHandler . "
+ " (+) "
+ " ."
End Sub
Sub ToolHandler
If WindowInfo( FrontWindow(),
WIN_INFO_TYPE ) = WIN_MAPPER Then
Print "X: " + Str$( CommandInfo(CMD_INFO_X) )
Print "Y: " + Str$( CommandInfo(CMD_INFO_Y) )
Print " "
End If
End Sub
CommandInfo( ),
, .
ToolHandler CommandInfo( ) ,
, .
SelChangedHandler
TEXTBOX.MB.
( ) ,
, , - .
( TEXTBOX.MB 2).
Sub SelChangedHandler
If SelectionInfo(SEL_INFO_NROWS) < 1 Then
Alter Menu Item create_sub Disable
Else
Alter Menu Item create_sub Enable
End If
End Sub
?
MapBasic
Main. ,
(, ToolHandler),
Main.
.
, (, c
). MapBasic
,
.
57
4: MapBasic
: - End Program,
, ,
. ,
End Program .
() MapBasic.
MapBasic MapInfo,
,
. MapInfo . 6
" ".
-
- !
, - .
, SelChangedHandler, MapInfo
Selection. MapInfo Selection
; , -
SelChangedHandler , .
SelChangedHandler
Select, ,
SelChangedHandler, NoSelect. :
Select *
From World
-
. ,
SelChangedHandler, MapInfo ,
. Select SelChangedHandler,
Select MapInfo .
.
Set Handler .
-, Set Handler ... Off,
. Set Handler ... On
, .
Sub SelChangedHandler
Set Handler SelChangedHandler Off
Select,
.
Set Handler SelChangedHandler On
End Sub
58
4: MapBasic
,
MapBasic :
BASIC ( Asc( ), Format$( ), Val( ) .), MapInfo
MapBasic (, Distance( ) ObjectGeography( ) ). MapBasic
. , ,
MapBasic.
Function...End Function,
Sub...End Sub .
Function...End Function :
Function _( , ) As ResType
End Function
, . (,
Integer, Date, String), .
Function...End Function ,
.
; MapBasic
.
money_format( ). money_format( )
( ) (
Format$( )), , ..
.
Declare Sub Main
Declare Function money_format(ByVal num As Float) As String
Sub Main
Dim dollar_amount As String
dollar_amount = money_format( 1234567.89 )
' dollar_amount "$1,234,567.89"
End Sub
Function money_format(ByVal num As Float) As String
money_format = Format$(num, "$,#.##;($,#.##)")
End Function
, ,
MapBasic.
( ).
59
4: MapBasic
MapBasic ,
:
Define - ,
- .
Include ,
, .
Define
Define
().
Define ,
. ,
,
16711680, , .
( ). ,
Define:
Define MY_COLOR 16711680
Define (MY_COLOR),
16711680. ,
Define, MY_COLOR ,
16711680. MapBasic MY_COLOR
16711680.
, "" .
, ,
MY_COLOR. ,
(65280). ,
Define :
Define MY_COLOR 65280
MapBasic, MAPBASIC.DEF,
Define, Define
(BLACK, WHITE, RED, GREEN, BLUE, CYAN, MAGENTA
YELLOW). Include MAPBASIC.DEF
.
60
4: MapBasic
Include
Include
MapBasic. Include
:
Include "_"
_ , MapBasic.
, Include, ,
, .
MapBasic Include ,
MapBasic MAPBASIC.DEF:
Include "mapbasic.def"
MAPBASIC.DEF Define,
MapBasic (TRUE, FALSE, RED, GREEN, BLUE, TAB_INFO_NAME ..).
DOS-
. , MapBasic ;
, ,
MapBasic.
MapBasic,
. ,
MapBasic.
, ,
FUNCTS.MB. ,
:
Include "functs.mb"
Include
MapBasic. 3 "
", MapBasic 50K
. ,
, Include
( . 3.).
61
4: MapBasic
MapBasic
, .
MapBasic. , Global
( Sub...End Sub).
.
:
Include "mapbasic.def"
Include
Type...End Type
Declare Sub
Declare Function
Define
Global
Main:
Sub Main
Dim
...
End Sub
:
Sub ...
Dim
...
End Sub
:
Function ...
Dim
...
End Function
62
5:
,
. : -,
, , ;
, ()
. ,
( ). ,
,
, .
. . .
....................................................... 63
............................................................. 64
MapBasic ............................................. 64
.................................................................... 66
5:
:
. , , 3.
, .
. ;
, (),
. , :
Map From RUSSIA
. ,
RUSSIA", .
MapInfo MapBasic-
.
,
. MAP_IT,
22. , MapBasic
( ) ,
.
MapBasic
. ,
(,
ROSSIA RUSSIA). ,
.
MapBasic ( Stop Continue),
MapBasic MapInfo.
64
5:
,
:
1.
MapBasic Stop ,
.
2.
Stop, MapBasic
MapBasic (,
TEXTBOX.MB, 23").
3.
MapBasic ( MapInfo):
? Dim, .
? Global, .
?_, .
?_ = ,
.
4.
, Continue
MapBasic, .
MAP BASIC
MapInfo. ,
MAP BASIC
MAP BASIC.
65
5:
Stop
MapBasic Stop
:
FunctionEnd Function.
Dialog,
.
ProgressBar.
, .
Run Application
MapBasic.
Stop .
,
Run Application. ,
TEXTBOX (. 2),
, MapBasic-.
Stop.
MapBasic Note Print
. ,
, Print:
Print " : " + counter
"".
. MapBasic
OnError.
, BASIC, :
MapBasic OnError .
. ,
.
OnError .
OnError ,
, . ,
, -
. MapBasic
,
.
Err( ),
( Integer). Error$( ) .
66
5:
MapBasic
ERRORS.DOC .
- Resume.
Resume , MapBasic .
, ,
OnError, Resume, Err( ) Error$( ) MapBasic.
.
. (
Resume), .
, ORDERS
.
bad_open ,
Open Table. not_mappable
Map.
Sub orders_setup
'
'
OnError Goto bad_open
'
'
bad_open .
Open Table "orders.tab"
OnError Goto not_mappable
'
'
not_mappable .
Map From orders
OnError Goto 0
Browse * From orders
last_exit:
Exit Sub
' Exit Sub
.
bad_open:
' ,
' Open.
Note " Orders ...
' ."
Resume last_exit
67
5:
not_mappable:
' ,
' Map
Note " ; +
."
Resume Next
End Sub
68
6:
. MapBasic
,
MapInfo.
. . .
................................................ 70
.................................................. 71
..................................................................................... 73
..................................................... 82
.............................................................. 85
...................................................................................... 94
.........................................................101
MapInfo................................................109
...........................111
6:
MapBasic
MapBasic,
MapInfo. MapBasic
:
: MapBasic
MapInfo .
:
.
: MapBasic MapInfo
(, ..) . MapBasic
""
MapInfo.
:
, .
MapInfo, "",
, MapBasic. , ""
(SCALEBAR) .
MapBasic "" (OVERVIEW),
MapBasic. OVERVIEW MapBasic
(T OOLS). ,
MapBasic . ,
MapBasic .
70
6:
MapBasic . , MapBasic
,
, (eventdriven).
?
(Graphical User Interface)
.
, ,
. , : ,
..
, ?
, , Windows
: , ,
.
, MapBasic ,
, MapBasic . MapBasic-
- ,
.
, :
1. MapInfo Create Menu, Alter
Menu .
2. - . sub-, . ,
. ,
MapInfo.
MapInfo, ,
).
3, Call sub-.
, Call .
Calling, Create Menu.
, TEXTBOX Create Menu:
Create Menu "" As
"& ..." Calling create_sub,
"&" Calling Bye,
"& """"..."
Calling About
71
6:
,
Calling (, "Calling create_sub").
Calling ,
TEXTBOX.MB. , "create_sub", "Bye" "About" sub.
, MapBasic
"create_sub". , "create_sub"
.
?
-. Create Menu, Create
ButtonPad, , Calling,
. , ,
Create ButtonPad .
MapBasic . PushButton
MapBasic - . ToolButton
MapBasic , .
.
MapBasic , ?
, MapBasic, -.
, , MapBasic
, .
- , ,
. ,
.
72
6:
. MapBasic
MapInfo.
MapInfo , .
:
MapInfo :
MapInfo. MapInfo ,
, , ..
,
. , .
. ,
, , .
;
, " "
" " .
ENTER, . :
, ..
, , .
() MapInfo
(sub-) MapBasic,
. , , MapInfo
, ,
sub- MapBasic-.
Alter
Menu. , (
, ):
Alter Menu "" Add
" "
Calling report_sub,
" " Calling report_sub_q
73
6:
, ,
MapInfo, MapBasic.
MENU.DEF ,
(, M_FILE_NEW > , M_EDIT_UNDO
> ..). Calling,
, MENU.DEF
, MapInfo , .
, .
, MapInfo M_MAP_THEMATIC
, >
.
Alter Menu "" Add
" " Calling M_MAP_THEMATIC
. MapInfo
> .
M_TABLE_DELETE, MENU.DEF.
Alter Menu "" Remove M_TABLE_DELETE
,
: Alter Menu ... Remove ,
; Create Menu ,
. ,
: , :
Create Menu "" As
" " Calling M_MAP_LAYER_CONTROL,
" " Calling M_MAP_PREVIOUS,
""
Calling M_MAP_PREVIOUS
Create Menu. ,
TEXTBOX Create Menu:
Create Menu "" As
"& ..." Calling create_sub,
"&" Calling Bye,
"& """"..."
Calling About
Create Menu . ,
.
.
, Alter Menu
Bar:
Alter Menu Bar
Add ""
74
6:
.
, , .
TEXTBOX :
, ""
Alter Menu.
Alter Menu "" Add
"(-",
"" As ""
"" :
MapBasic
:
, .
75
6:
() .
;
.
. .
Create Menu MapBasic.
.
.
. ( (,
.)
, ,
, :
Alter Menu Item PickFrame Enable
,
, :
Alter Menu Item PickFrame Disable
MenuToggler
Enable
76
MenuToggler
6:
MapInfo . ,
> , ,
.
MapInfo MapBasic.
Alter Menu Bar.
, :
Alter Menu Bar Remove ""
( ID- 7).
: .
.
Create Menu Bar. ,
, ,
, , , ( ):
Create Menu Bar As
"", "", "", "", ""
MapInfo ( , ..)
Create Menu Bar MapBasic.
MapInfo Create Menu Bar As
Default.
( ..).
MapInfo: . , , ,
"" "ID 1".
( 3) :
Alter Menu Bar Remove ID 3
, ,
-.
77
6:
MapInfo File" (
), .
, MapInfo,
Create Menu Bar MapBasic.
MapInfo
MapInfo 5.0 , ,
. ,
, , :
Alter Menu, Alter Menu Item, Create Menu.
ID-. , ,
, ,
"MapperShortcut" ID 17. ID- ,
Alter Menu MapBasic.
, Create Menu ,
MapInfo, " (- "
. :
Create Menu MapperShortcut ID 17
As (-
"report_sub", ID-; ,
CommandInfo( ), ,
, :
Sub report_sub
If CommandInfo(CMD_INFO_MENUITEM) = 201 Then
'
' ... , ...
'
ElseIf CommandInfo(CMD_INFO_MENUITEM) = 202 Then
'
' ... , ...
'
End If
End Sub
78
6:
- .
Alter Menu Item
-, MapBasic ,
. ,
( , , , ):
Alter Menu Item report_sub Disable
,
. ,
:
Alter Menu Item
ID 201
Disable
- .
,
. ,
. ,
ALT+,
.
, (&).
Windows, Macintosh.
,
ALT+ C:
Create Menu "" As
"& ..." Calling create_sub,
...
"" ( )
. ""
, .
"" CTRL+Z:
Alter Menu "" Add
" " + Chr$(9) + "CTRL-Z/W^%122" Calling new_sub
"CTRL+Z" , ,
"" .
"+ Chr$(9)"
. ""
.
"/w^%122"
CTRL Z. "/w^%122" MapInfo : "/w"
, MapInfo Windows, "^"
CTRL, "%122" z" (122 ASCII-
"z"). ""
, ; Windows
79
6:
, ; ,
MapInfo CTRL+ , CTRL+Z.
, ,
CreateMenu MapBasic.
MAPINFOW.MNU
MapInfo 3 .
MapInfo , .
UNIX MAPINFO.MNU; MapInfo Machintosh
Mapinfo.Menus; MapInfo Windows MAPINFO.MNU.
, ,
MapBasic.
MAPINFOW.MNU, -
MapInfo. , MAPINFOW.MNU,
, MapBasic.
: - MAPINFOW.MNU,
, , BACKUP.MNU. , MAPINFOW.MNU
, MapInfo, , . MapInfo
MAPINFOW.MNU .
MAPINFOW.MNU , ,
MapInfo.
MAPINFOW.MNU Create Menu;
MapInfo ( , ..).
,
Create Menu.
, MapInfo >
, , .
MAPINFOW.MNU, ,
:
Create Menu "&" As
"&..."
calling 404,
"&..."
calling 409,
"&..."
calling 410,
"&..."
calling 403
...
80
6:
, .
(&..." Calling 409)
MAPINFOW.MNU; Create Menu,
, :
Create Menu "&" As
"&..."
calling 404,
"&..."
calling 410,
"&..."
calling 403
...
MapInfo >
:
, , ,
Create Menu Bar MAPINFOW.MNU .
MapInfo MAPINFOW.MNU
, MapInfo,
MapInfo . ,
,
.
,
. ,
, .
, MAPINFOW.MNU
, . Windows
, WIN.INI.
MapInfo,
MAPINFOW.MNU . MAPINFOW.MNU
, MapInfo .
MAPINFOW.MNU , MapInfo
, MapInfo.
, , MAPINFOW.MNU
, .
MAPINFOW.MNU, ,
MapInfo, .
81
6:
MapBasic,
MapInfo,
Run Menu Command. ,
MapInfo > "
":
Run Menu Command M_FILE_OPEN
M_FILE_OPEN MENU.DEF.
( ) .
MapBasic ,
:
Note OK.
Ask( ) .
"OK" "Cancel", .
82
6:
"OK", (TRUE)
(FALSE) .
FileOpenDlg( ) > .
, .
"", .
Windows 3.1
FileSaveAsDlg( ) >
, .
83
6:
-
ProgressBar "".
MapInfo , .
. ,
MapBasic.
, MapBasic, ,
. , MapBasic-, Windows,
FileOpenDlg( ),
Windows. , Macintosh,
FileOpenDlg( ) , Macintosh.
MapBasic. ,
Dialog , .
84
6:
Dialog . , MapInfo
.
( "OK" ""), MapInfo
, Dialog.
Dialog CommandInfo( ) , ("OK"
"") .
, , .
Control Dialog. ,
: ( StaticText); ,
( EditText); "OK"
( OKButton) "" ( CancelButton).
Dim _ As String
Dialog
Title ""
Control StaticText
Title " :"
Control EditText
Into _
Control OKButton
Control CancelButton
If
'
'
'
'
'
End
CommandInfo(CMD_INFO_DLG_OK) Then
... "OK",
String "_"
, .
If
Dialog :
85
6:
Control Width Height .
, Position.
,
. Position
Title ( ):
Dialog
Title ""
Control StaticText
Title " :"
Control EditText
Into _
Control OKButton
Title ""
Position 50, 30
Control CancelButton
Position 110, 30
Position Control :
.
, .
0, 0 .
Position
:
Position
20, 16
, 20, ,
. , 16,
, .
Position .
Width Height ,
.
86
6:
(, ,
).
MapBasic .
StaticText
(EditText)
(GroupBox)
(SymbolPicker)
(Ra
dioGroup)
(MultiListBox)
(ListBox)
-
(PopupMenu)
(CheckBox)
(Button)
(CancelButton)
(OKButton)
StaticText , :
Control StaticText
Title " :"
Position 5, 10
EditText , . :
Control EditText
Value " "
Into maptitle
ID 1
Position 68, 8 Width 120
GroupBox .
; .
:
Control GroupBox
Title " "
Position 5, 30
Height 40 Width 90
87
6:
RadioGroup ,
, :
Control RadioGroup
Title "&;&"
Value 2
ID 2
Into details
Position 15, 42 Width 72
ListBox , .
MapBasic ,
. :
Control ListBox
Title " "
"1- ;2- ;3- ;4- ;
;"
ID 4
Value 5
Into quarter
Position 10, 92 Width 65 Height 40
, MultiListBox,
, Windows
SHIFT CTRL.
:
Control MultiListBox
Title ";;;;"
ID 5
Value 3
Position 115, 92 Width 65 Height 40
( PopupMenu) ,
. .
:
Control PopupMenu
Title ";;;; "
Value 2
ID 6
Into mapscope
Position 10, 157
(CheckBox) .
:
88
6:
Control CheckBox
Title " &"
Into showlegend
ID 7
Position 115, 155
( Button) ; ,
. MapBasic OKButton and CancelButton,
"OK" "", .
:
Control Button
Title "&"
Calling resetsub
Position 10, 190
Control OKButton
Title "OK"
Calling oksub
Position 160, 190
Control CancelButton
Title ""
Position 110, 190
OKButton
CancelButton. , , ; ,
"OK" "",
. , , , MapBasic ,
Dialog.
C MapBasic. ,
ListBox Control Listbox.
Value.
. ,
,
( ListBox), Value ListBox:
Value 4
Value , MapInfo
. , ( CheckBox) .
Value
C MapBasic ( Control...).
Into.
,
. , MapBasic ,
Into, "OK".
, Into,
, ,
89
6:
. , EditText (
String), (CheckBox) (TRUE
, FALSE ). MapBasic
.
, , "OK", MapBasic
, Into;
, , ReadControlValue( ).
- ,
.
-.
( sub-), ,
.
- Calling handler; sub ; ,
; - ,
(, ,
, OKButton CancelButton, ).
- ,
. , ";
,
. ,
" -,
Alter Control, .
ListBox MultiListBox ,
.
CommandInfo(CMD_INFO_DLG_DBL).
(NVIEWS.MB). " "
, MapBasic (. 1),
; ,
( , ,
"OK").
Calling
-, .
TriggerControl( ) ID- , ,
.
GroupBox, StaticText EditText .
-, .
Dialog Calling,
Control, Calling -
.
Alter Control -.
, , ,
. Alter
90
6:
Control (.. ). .
Alter Control C MapBasic.
, , .
.
. , :
Control
Disable. ,
.
- Alter Control
. ,
- ;
( Control)
Calling. .
Alter Control, .
, . , Alter
Control If...Then,
.
: Alter
Control, ID
Dialog. Alter Control
MapBasic.
91
6:
ListBox .
ListBox:
, ,
. :
Control ListBox
Title "1- ;2- ;3- ;4-+
"; "
( String)
. Control From
Variable . ,
"s_list", :
Control ListBox
Title From Variable s_list
From Variable
MapBasic (ListBox, MultiListBox PopupMenu).
MultiListBox
MultiListBox,
-, , ()
. ,
MultiListBox, OKButton, .
ReadControlValue( ).
ReadControlValue( ) ;
..
ReadControlValue( ) , MapBasic ,
. ReadControlValue( ) ,
, .
-
MultiListBox, Alter Control (Value 0).
Alter Control.
MultiListBox
:
Alter Control 1
Alter Control 1
Value 1
Value 2
92
6:
,
MapBasic-, Windows,
. ,
, .
(&)
, .
Control "" :
Control Button
Title "&"
Calling reset_sub
"&" ,
ALT+. ,
(&&).
EditText . ,
StaticText, EditText,
, ,
( ).
, Windows, Macintosh
UNIX.
, Dialog, ,
OK . ,
MapInfo, , Dialog.
, ,
MapInfo,
(, Visual Basic), MapBasic- (,
Run Command).
, MapBasic Dialog,
, :
OKButton ( ).
CancelButton ( ).
(, ESC).
, -
Dialog Remove.
, OKButton
CancelButton. ,
, "" (.. CancelButton),
( " ,
?").
93
6:
Dialog Preserve ,
OKButton CancelButton.
- OKButton CancelButton.
Dialog Remove .
-. Dialog Remove , ,
ListBox.
MapBasic
MapInfo: (, ..).
, :
Map, Browse, Graph, Layout Create Redistricter.
, ,
.
MapInfo (, ..) Open Window.
Set Window. ,
Set Window . MapBasic
, : ,
Set Map ,
Set Browse .
(, , , ) MapInfo
(ID-). ID-
. ,
, Set Map ,
.
ID- ,
FrontWindow( ). ,
OVERVIEW Map, ,
FrontWindow( ), ID- .
OVERVIEW ID-.
, ,
1, 2 .. ,
FrontWindow( ) WindowID( ). , ID-
WindowID(1).
, NumWindows( ).
WindowInfo( ) . ,
, ,
FrontWindow( ) ID- , WindowInfo( )
.
Close Window .
:
94
6:
.
, ;
.
:
Map From world, worldcap, grid30
6:
( Commit Table
... As).
Set
Window.
Add Map Layer Animate,
. MapInfo
, .
,
. , , (
), .
GPS (Global Positioning System)
.
,
.
, :
Open Table vehicles Interactive
Add Map Layer vehicles Animate
.
; ,
.
.
, .
.
ANIMATOR.MBX.
.
:
, .
.
, .
. ,
: ROADS (, ) TRUCKS (,
, ).
96
6:
.
,
Add Map Layer Trucks Animate
, Trucks
. ,
.
, .
Truck:
Set Event Processing Off
Set Map Layer Trucks Display Off
Trucks
Add Map Layer Trucks Animate
Set Event Processing On
: Trucks,
.
WORLD:
Browse * From world
. ,
,
, . ,
, WORLD:
Browse country, capital From world
Browse ,
. , Format$( )
"" WORLD.
.
Browse country, Format$(, ",#") From world
Browse ,
( ). ,
Browse , ,
. , , -
, .
, Browse,
. ,
(.. ):
Browse country, Format$(, ",#") ""
From world
97
6:
"" (), ,
, .
,
; ,
:
Browse * From world Row 5 Column 2
, ,
.
, :
Graph , From world
Graph ,
; ,
. , ,
, .
. Layout.
.
, Create Frame.
. ,
, Create Text.
. ,
Insert, Layout1." ,
, , , (
). 7 ,
, .
,
"" : .
. 9.
Create Redistricter.
,
> .
,
Set Redistricter. ,
Run Menu Command. , (,
> ),
:
Run Menu Command M_REDISTRICT_ASSIGN
Close
Window. , ,
98
6:
.
, .
, Commit.
MapInfo.
MapBasic Print . :
Print " ."
.
, .
, Set Window. :
, .
Include mapbasic.def
Open Table World Interactive
Select
Country, Capital, Inflat_Rate + 0 Inflation
From World
Into WORLD_QUERY
Set Window Info
Title
Table WORLD_QUERY
Rec 1
Font MakeFont(Arial Cyr, 1, 10, BLACK, WHITE)
Width 3 Units in Height 1.2 Units in
Position (2.5, 1.5) Units in
Front
:
1. ".
Title, "
."
2. , ,
Table ... Rec Set Window.
99
6:
WORLD_QUERY. (WORLD_QUERY ,
Select.)
3. ;
.
, Select,
, WORLD_QUERY.
WORLD_QUERY ;
.
, ,
:
1. Select, .
2. Select , .
Select, , " Inflat_Rate + 0 "
. ( "",
(alias) .)
Select Country, Capital, Inflat_Rate + 0
: ,
, ( StreetInfo)
, Group By,
.
100
6:
(ButtonPads)
MapInfo.
, . ,
MapInfo.
MapInfo .
MapBasic
.
?
, ,
-,
. , , MapBasic
, sub, .
MapBasic : -
(ToolButtons), - (ToggleButtons) (PushButtons).
, MapBasic
.
(PushButton):
,
.
" ",
.
- (ToggleButton):
"" "". MapBasic
-.
/
.
, "";
.
- (ToolButton): -
MapInfo, ,
. MapBasic -
, ,
.
" " " " ; ,
, .
MapBasic,
MapBasic:
101
6:
Create ButtonPad
.
Alter ButtonPad
, ,
.
Alter ButtonPad ("" .).
, ""
, .
Alter Button
Alter Button
.
CommandInfo( )
CommandInfo( ) ,
, .
, ToolButton (
) , CommandInfo( )
, .
, CommandInfo( )
, . , CommandInfo( ):
, (2 ,
) , , , SHIFT
.
ToolHandler
ToolHandler , .
ToolHandler, ""
ToolButton,
ToolHandler, ,
, .
MapBasic- ( +),
, . Create ButtonPad
Alter ButtonPad , .
MapBasic
ToolHandler, ""
.
PushButton
,
PushButton. button_prompt ,
102
6:
, .. , MapBasic
button_prompt.
Include "icons.def"
Declare Sub Main
Declare Sub button_prompt
Sub Main
Create ButtonPad " " As
PushButton
Icon
MI_ICON_ZOOM_QUESTION
Calling button_prompt
HelpMsg " "
Show
End Sub
Sub
'
'
'
End
button_prompt
,
.
...
Sub
""
Create ButtonPad . MapBasic
MapInfo.
Alter ButtonPad, Create ButtonPad:
Alter ButtonPad ""
Add Separator
Add PushButton
Icon
MI_ICON_ZOOM_QUESTION
Calling button_prompt
HelpMsg " "
Show
6:
MapInfo, "",
, MapBasic. ,
"" (ScaleBar) "".
ToolButton
ToolButtons
MapInfo, , . ToolButton,
,
() ,
.
ToolButton.
. , ,
, , MapInfo ,
, ,
.
Include
Include
Declare
Declare
"icons.def"
"mapbasic.def"
Sub Main
Sub draw_via_button
Sub Main
Create ButtonPad " " As
ToolButton
Icon
MI_ICON_LINE
DrawMode DM_CUSTOM_LINE
Cursor MI_CURSOR_CROSSHAIR
Calling draw_via_button
HelpMsg " ."
Show
End Sub
Sub draw_via_button
Dim x1, y1,x2, y2 As Float
If WindowInfo(FrontWindow(), WIN_INFO_TYPE) <> WIN_MAPPER Then
Note " ."
Exit Sub
End If
' , :
x1 = CommandInfo(CMD_INFO_X)
y1 = CommandInfo(CMD_INFO_Y)
' , :
x2 = CommandInfo(CMD_INFO_X2)
y2 = CommandInfo(CMD_INFO_Y2)
' x1, y1, x2 y2, .
End Sub
104
6:
ToolButton DrawMode.
MapBasic, , , .
DM_CUSTOM_LINE; ,
, .
DM_CUSTOM_POINT,
.
DrawMode , -
, . DM_CUSTOM_LINE, MapBasic
, .
DM_CUSTOM_RECT, MapBasic ,
.
, DrawMode, MapInfo , .
(, ESC
), MapInfo . -
CommandInfo( ) ,
.
ICONS.DEF, Alter
ButtonPad MapBasic.
, ,
. , , Icon.
Icon ICONS.DEF. ,
, Info MapInfo's.
MI_ICON_INFO ICONS.DEF.
Alter ButtonPad
Add Separator
Add PushButton
Icon
MI_ICON_INFO
Calling procedure_name
MapInfo 4.0 ,
MapInfo. ,
ICONDEMO.MBX,
. ,
. .
:
1. ICONDEMO.MBX.
2. > .
:
105
6:
3. . .
4. Ctrl+ (
).
5. OK, .
6. MapBasic. Ctrl+ (
).
,
ToolButton ,
; , MapInfo -.
, , , ,
Select.
,
. CommandInfo( ) ,
. Select,
, .
Sub t_click_handle
Dim fx, fy As Float
fx = CommandInfo(CMD_INFO_X)
fy = CommandInfo(CMD_INFO_Y)
Select * From Russia
Where obj Contains CreatePoint(fx, fy)
End Sub
: MapBasic 4.0 ,
. Select
SearchPoint( ) SearchRect( ),
SearchInfo( ) .
SearchInfo( ) MapBasic.
SelChangedHandler.
SelChangedHandler, MapInfo ,
106
6:
.
"",
SelChangedHandler.
,
MapInfo (,
) . ,
, :
:
Create ButtonPad As
ToolButton
Icon MI_ICON_ARROW
Calling M_TOOLS_SELECTOR
HelpMsg /n
ToolButton
Icon MI_ICON_LINE
DrawMode DM_CUSTOM_LINE
Calling sub_procedure_name
HelpMsg /n
Calling M_TOOLS_SELECTOR,
MENU.DEF. (
MapInfo MENU.DEF). ,
Calling .
DrawMode,
, .
: ToolButton ToggleButton .
ToolButton ToggleButton .
ToolButton , ToggleButton
.
MapInfo ,
, ToolButton ToggleButton.
MAPINFOW.MNU. .
.
, MapBasic
:
. ,
. , .
107
6:
. ,
.
,
.
, StatusBar.
.
Alter Button Pad
. :
Alter ButtonPad Fixed
Fixed . Float
.
Create Button Pad,
.
ButtonPadInfo().
MapBasic :
/ . MapBasic
.
MapBasic, Alter ButtonPad.
() .
MapBasic.
. . MapBasic
Windows -.
, .
MapBasic. MapBasic
, .
11.
108
6:
MapInfo
, MapBasic , , .
:
?
MapInfo MapBasic- >
MAP BASIC. ,
MapInfo, ,
,
MapInfo.
Windows MapInfo , ..
, MapInfo.
:
1. MapInfo.
2. ALT+ENTER FILE > PROPERTIES
( >).
3. "Program Item properties" ("
") "Command Line" (" ")
:
\mapinfo\mapinfow.exe
4. , , DISPATCH.MBX;
:
\mapinfo\mapinfow.exe
c:\mapinfo\dispatch.mbx
5. OK.
MapInfo MapBasic,
.
Windows95 () ,
.
MapInfo " "(, ,
> .
MapBasic- MapInfo, "
" ; , ,
, :
.
STARTUP
STARTUP ,
MapInfo. Run Application,
MapInfo .
, SCALEBAR,
STARTUP:
109
6:
!workspace
!version 300
!Charset Neutral
Run Application "scalebar.mbx"
MapInfo .
Run Application MapBasic.
" ",
MapInfo. (
), " " (
).
Windows STARTUP.WOR
MapInfo Windows (,
WIN.INI). STARTUP.WOR ,
MapInfo .
Macintosh "Startup Workspace"
MapInfo, (System)
(Preferences).
, ,
, MapInfo. ,
,
(, Windows 3.x ,
WIN.INI).
MapBasic
,
. , MapBasic
-
. , , :
1. MapInfo > MAP BASIC
TEXTBOX ("").
2. > > "",
" """.
3. "". MapInfo ,
""
MapInfo.
4. OK " ". MapInfo
, "" .
" """ OK.
5. MapInfo.
.
, 4 "OK",
TEXTBOX Run Application .
, TEXTBOX .
110
6:
AUTO_LIB.MB.
;
.
AUTO_LIB.MB MapBasic.
.
, ,
. .
MapInfo .
, , .
:
Print . ,
Print.
,
, Print Chr$(12).
(
).
MapInfo,
( ) Set ProgressBars Off.
, MapInfo
, . , , MapInfo .
111
7:
MapBasic . ,
Alter Table
Fetch. Import
MapInfo , Export
.
MapBasic,
.
MapBasic.
. . .
.................................................................
MapBasic .........................................
..................................
................................
........................................................
.............................................................
...................................................
Selection .......................................................
CosmeticN .........
LayoutN ....................
..............................
- .....................................................
, ...............................
.............................................................
...................................................
......................................................
...............................................................
.....................................
113
114
117
118
122
123
124
126
128
129
130
134
135
137
140
142
144
144
7:
MapBasic
MapBasic,
. Open Table. ,
WORLD:
Open Table "C:\mapinfo\data\world"
: MapInfo (,
, ),
, . .
" , MapInfo ".
, a MapBasic
. ,
WORLD ,
Open Table.
, - .
, , NumTables( ).
TableInfo( ).
,
-. , Open Table ,
(C:\MAPINFO\DATA\WORLD"),
(world").
Open Table "C:\mapinfo\data\world"
Browse * From world
MapBasic - .
, Open Table As.
, Open Table WORLD "Earth":
Open Table "C:\mapinfo\data\world" As Earth
Browse * From Earth
, Browse
(Earth). , .
(.. , ), Rename Table.
Interactive Open Table
, MapInfo ,
, .
Interactive , Open
Table .
114
7:
MapBasic .
, STATES, PIPELINE PARCELS,
:
Select * From States
Browse * From Pipeline
i = NumCols(Parcels)
, -. , ,
.
, ,
. ,
ZONING, :
Dim work_table As String
work_table = "Zoning"
Browse * From work_table
, MapInfo
. ,
C:\DATA1994\SITES", MapInfo
(sites"); (,
C:\BACKUP\SITES"), MapInfo ,
.
. MapInfo
sites_2."
Open Table Interactive, MapInfo
, .
Interactive, MapInfo .
, ,
.
TableInfo( ), :
Include "mapbasic.def"
Dim s_filename As String
Open Table "States" Interactive
s_filename = TableInfo(0, TAB_INFO_NAME)
Browse * from s_filename
TableInfo(0, TAB_INFO_NAME) -
.
, MapInfo
,
MapInfo (dBASE, Lotus, Excel ).
MapBasic,
. MapInfo (.TAB)
115
7:
. .
, MapInfo.
dBASE:
Register Table "INCOME.DBF" Type DBF
, ,
MapInfo Open Table.
Open Table "INCOME" Interactive
MapInfo ,
. , Select (
SQL) ,
.
, MapInfo
. .DBF-,
MapInfo ; Update.
MapInfo .DBF-. MapInfo
,
(ASCII) . ,
( Commit Table ... As) .
116
7:
MapInfo
,
MapInfo, ,
Seagate Crystal Reports.
. Create Report From Table Open Report
MapBasic.
MapBasic ()
/ () . :
1. Fetch , ()
. .
2. (,
_._)
.
, "Country"
WORLD:
Dim s_name As String
Open Table "world" Interactive
Fetch First From world
s_name = world.Country
(
, ).
Fetch .
,
.
Fetch
. ,
,
. , Fetch ,
EOT( ). Fetch EOT( )
MapBasic.
MapBasic ,
:
_._
world.country
_.COLn
world.COL1
_.COL(n)
world.COL(i)
117
7:
:
_._ (world.country).
_.col#.
, (, col1 ).
"Country" WORLD,
-:
s_name = world.col1
_.col(_).
() ,
.
:
Dim i As Integer
i = 1
s_name = world.col(i)
,
.
, _ .
, Browse .
, (
From), .
Select Country, Population/1000000 From World
Browse Country, Col2 From Selection
Select From, ,
. Select ,
, _.
From Select ,
_.
Select MapInfo
"Select" MapBasic.
: COLn
COL(n). Select ;
,
Population/1000000. Browse
col2 col(2),
Population/1000000 .
Alias
.
,
Select Country, Population/1000000 From World
"Country" "Population" .
118
7:
, .
, ,
.
MapBasic Alias,
.
String, Alias . MapBasic
Alias ,
. :
Dim val_col As Alias
val_col = "Inflat_Rate"
Select * From world Where val_col > 4
MapIt(
119
7:
_._.
:
Dim tab_expr As Alias
Open Table "world"
Fetch First From world
tab_expr = "world.COL1"
Note tab_expr
Note , :
Note world.COL1
_._ (, world.population)
, Type (..
). MapBasic
. .
, MapBasic
. , MapBasic
.
RowID"
RowID , () .
RowID ,
. RowID , ,
, .
RowID () 1, 2 ..
World:
Select * from world Where RowID = 1
RowID Select ,
1990 .
Dim median_row As Integer
Select * From states Order By pop_1990 Into bypop
median_row = Int(TableInfo(bypop,TAB_INFO_NROWS)/2)
Select * From bypop Where RowID > median_row
TableInfo( )
BYPOP, median_row
. ,
BYPOP.
,
, . (
.) -
RowID.
RowID;
, RowID . ,
120
7:
> > MapInfo MapBasic Pack
Table.
Obj"
MapInfo . Obj
. ,
, Obj (
). ,
Obj.
, :
Select * From sites Where Not Obj
, , ,
, .
,
Object:
Dim o_var As Object
Fetch First From sites
o_var = sites.obj
9.
MapInfo >
. MapBasic Find
Find Using. Find Using ,
; Find
(, 23 "). Find
,
(., && ").
Find CommandInfo( ):
, , , .
> MapInfo Find MapBasic
.
, Set Map Center.
, Find ,
: CreatePoint() Create Point.
. Find MapBasic
.
, , :
1. Fetch, .
2. Find Using Find, .
121
7:
3. CommandInfo ()
Find; CommandInfo () ,
x y .
4. , CreatePoint () Create
Point.
5. Update, .
, () ,
:
Run Menu Command M_TABLE_GEOCODE
,
MapMarker, . MapMarker
, MapInfo,
. MapBasic MapMarker
. MapMarker
MapInfo;
MapInfo.
SQL-
MapInfo
> SQL-. "SQL-"
MapBasic Select. Select
, , .
Select MapBasic.
MapBasic
. ,
"states.pop", MapBasic ,
STATES "pop". ,
, . , (
"states.pop") , .
, . ,
Interactive Open Table;
, ,
.
; Open Table
TableInfo(0, TAB_INFO_NAME), ,
. . Open Table
MapBasic.
122
7:
, Insert.
Update .
MapBasic.
, Commit.
, RollBack.
Create Table () .
, Create Index,
Create Map.
, ,
, , , , .
"name" "CustID" .
Create Table CUST
(Name Char(20),
Address Char(30),
City Char(30),
Amount Decimal(5,2),
OrderDate Date,
CustID Integer)
File "C:\customer\Cust.tab"
Create Map For CUST CoordSys Earth
Create Index On CUST (CustID)
Create Index On CUST(Name)
(, Selection ) Commit
Import.
123
7:
, (), ,
. MapInfo
> > . MapBasic
Alter Table Create Index.
, ,
. ,
( Commit) ( Rollback),
.
Alter Table .
"Address" "ShipAddress", "Name" 25
, "Amount", : "Zipcode"
"Discount", .
Alter Table CUST (Rename Address ShipAddress,
Modify Name Char(25),
Drop Amount
Add Zipcode Char(10),
Discount Decimal(4,2)
Order Name, Address, City, Zipcode,
OrderDate, CustID, Discount)
,
(ASCII) ,
Selection.
Add Column .
() ,
. Add Column
() ,
. , , ,
.
, .
Add Column
,
. Add Column
MapBasic.
124
7:
MapInfo.
, MapInfo,
, . , ,
,
() .
. SQL-
, , Where,
. , ,
. Obj .
MapBasic-, Create Index.
Drop Index .
: MapBasic , ;
MapBasic .
.
Select Order By
.
TableInfo( ), ColumnInfo( ) NumTables( )
.
TableInfo( ) , ,
.
ColumnInfo( ) , ,
, , .
NumTables( ) ( ,
1).
,
.
Include "mapbasic.def"
Dim i, table_count As Integer
Dim tablenames() As String
table_count = NumTables() '
ReDim tablenames(table_count) ' ,
' .
For i = 1 To table_count
'
'
tablenames(i) = TableInfo(i, TAB_INFO_NAME)
Print tablenames(i)
'
'
Next
Print "*******"
'
125
7:
Selection
"Selection" ,
. MapBasic ( )
Selection , . ,
:
Browse * From Selection
Selection MapInfo
- "N", N ,
. Selection, N .
SelectionInfo( ) , -
MapInfo Selection (, 1 2). SelectionInfo( )
Selection (
..).
: "Selection"
MapInfo , MapBasic (.
).
N
MapInfo, , "N"
(1, 2, ..). ,
,
"1 " N .
MapBasic N. ,
Selection.Obj MapInfo N.
, MapBasic N,
:
Select,
Into. , , "Selection"
, Into.
Into, MapInfo N,
. , ,
Close Table.
(, ),
, MapInfo N.
, N.
126
7:
?
i_open = NumTables()
. :
Fetch First From Selection
obj_copy = Selection.obj
N
If NumTables() > i_open Then
Close Table TableInfo(0, TAB_INFO_NAME)
End If
Selection
Select . Select
.
Select , , ,
. > SQL-
MapInfo MapBasic Select.
, Select
( N),
. Select Into,
. ,
Active:
Select * From sites
Where growth > 15
Into Active
SQL- MapInfo.
Select . "Select" MapBasic.
Update Selection.
Selection, ,
.
, Select
"employees". Select Update,
.
Select * from employees
Where department = "marketing" and salary < 20000
Update Selection
Set salary = salary * 1.15
Update "employees",
"employees".
127
7:
Selection
Selection .
,
, . ,
(); ,
(), .
TEXTBOX ( )
"/".
, >> .
TEXTBOX Selection
.
SelectionInfo( ). SelectionInfo( )
, ( ).
SelectionInfo( ) ,
. ,
TableInfo( ).
SelChangedHandler,
MapInfo ,
. ,
, , , .
, SelChangedHandler.
SelectionInfo(SEL_INFO_NROWS),
.
Alter Menu Item
. 6.
CosmeticN"
, ,
. MapBasic
CosmeticN ( N
Integer, 1).
, Cosmetic1
.
:
Select * From Cosmetic1
,
, WindowInfo( ) WIN_INFO_TABLE.
,
:
Delete From WindowInfo(FrontWindow(), WIN_INFO_TABLE)
128
7:
LayoutN"
MapBasic .
,
LayoutN ( N , 1).
, Layout1 ,
. :
Select * From Layout1
, ,
WindowInfo( ) WIN_INFO_TABLE.
, ,
"" ( ,
). MapBasic,
, Set
CoordSys, Layout.
, TEXTBOX ( ) (
) ,
, .
, TEXTBOX Set CoordSys Layout.
MapInfo ""
,
.
"" (, >
), "" T Cosmetic1 1
." , ,
"" Layout1 1
."
129
7:
-
.
MapInfo .
, . ,
MapBasic- .
, .
1.
.
, , .
, .
. (, ).
. MapInfo
. -
.
MapBasic, .
, MapInfo .
,
.
: , , ,
. , ,
.
2. .
, > .
. MapInfo
<
>.DAT.
:
130
7:
, MapInfo
. ,
.
,
.
:
,
. ,
Open Table
-
, MapInfo .
,
.
3. ,
.
, ,
> , . MapInfo
< >.DAT .
:
, MapInfo
. ,
.
,
.
.
,
/.
.
MapBasic , Set File Timeout.
,
, Set File Timeout . ,
, :
Set File Timeout 100
7:
/. 100 ,
, MapInfo .
MapBasic . ,
Insert .
, ,
. ,
OnError.
, ( ),
OnError
( 5).
: Set File Timeout OnError . ,
, . ,
, .
:
Function MakeNewRow(ByVal new_name As String) As Logical
Set File Timeout 0
Set Event Processing Off
OnError Goto trap_the_error
Insert Into Sitelist (Name) Values ( new_name )
Commit Table Sitelist
MakeNewRow = TRUE
exit_ramp:
Set Event Processing On
Exit Function
trap_the_error:
, Insert Commit
If Ask( ; ?, , ) Then
... .
Resume 0
Else
.
Insert
132
7:
Commit, .
Rollback Table Sitelist
:
MakeNewRow = FALSE
Resume exit_ramp
End If
End Function
,
, .
, , Commit
Insert .
Set Event Processing Off,
; MapInfo
. , Insert
, , ,
(,
).
. ,
, .
, ,
MapInfo , ,
. MapBasic Open Table
, , MapInfo
. .
, . Open Table,
, ,
-.
Retry_point:
Open Table G:\MapInfo\World
If TableInfo(World, TAB_INFO_READONLY)
Close Table World
Goto Retry_point
End If
Then
133
7:
-
:
( ..); ;
( ); .
( ) ,
MapInfo: .DBF, Lotus .WKS .WK1, (ASCII )
.XLS- Excel.
_.tab: .
_.dat _.dbf _.wks ..:
.
_.map: .
_.id: .
_.ind: .
,
.
> > MapInfo Rename Table
MapBasic.
134
7:
,
, ( ),
, .
,
. : .TAB- (
)
, . ,
PHOTO.TIF, :
PHOTO.TIF PHOTO.TAB.
MapInfo.
, Open Table.
, Map.
, Add Map Layer. ,
Select.
, , TableInfo( )
TAB_INFO_TYPE. , TableInfo( )
TAB_TYPE_IMAGE.
, MapInfo
, . :
Drop Table
MapInfo .TAB-,
.
Rename Table MapInfo
.TAB-,
.
Commit
MapInfo .TAB-,
.
TAB- ,
" ". .TAB-
MapBasic, /:
Open File Print #;
. .
, .TAB-
.
:
( , ).
. ,
(, ),
.
135
7:
Include "mapbasic.def"
Declare Sub Main
Declare Function register_nonmap_image(ByVal filename As String,
ByVal tablename As String) As Logical
Sub Main
Dim fname, tname As String
fname = "c:\data\raster\photo.gif" '
'
tname = PathToDirectory$(fname)
+ PathToTableName$(fname) + ".tab" '
'
If FileExists(tname) Then
Note " ;
'."
Else
If register_nonmap_image(fname, tname) Then
Note " : " + fname + "."
Else
Note " ."
End If
End If
End Sub
Function register_nonmap_image( ByVal filename As String,
ByVal tablename As String) As Logical
register_nonmap_image = FALSE
OnError GoTo handler
Open File tablename For Output As #1 FileType "MIta"
Print #1, "!Table"
Print #1, "!Version 300"
Print #1, "!charset WindowsLatin1"
Print #1
Print #1, "Definition Table"
Print #1, " File """ + filename + """"
Print #1, " Type ""RASTER"" "
Print #1, " (1,1) (1,1) Label ""Pt 1"", "
Print #1, " (5,1) (5,1) Label ""Pt 2"", "
Print #1, " (5,5) (5,5) Label ""Pt 3"" "
Print #1, " CoordSys NonEarth Units ""mm"" "
Print #1, " Units ""mm"" "
Print #1, " RasterStyle 1 45" ' Brightness; default is 50
Print #1, " RasterStyle 2 60" ' Contrast; default is 50
Close File #1
register_nonmap_image = TRUE ' ,
'
last_exit:
Exit Function
handler:
Close File #1
Resume last_exit
End Function
136
7:
?
, .TAB .
,
, .
MapInfo.
(
.TAB- - TABLEMGR).
MapBasic- .
( )
. , , ,
, .. , , "\Copyright",
" Copyright 1995 Acme Corp.
?
, "\" (
). .
.
239 .
.
()
\Copyright Notice
Copyright 1995 .
\Info
\Info\Author
\Info\Date\Start
12/14/95
\Info\Date\End
12/31/95
\IsReadOnly
FALSE
.
, ,
(\).
, "\Info".
(,
).
"\IsReadOnly" ,
MapInfo. , MapInfo
\IsReadOnly. .
137
7:
, ,
. , ,
MapBasic .
GetMetadata$( ) ,
. ,
"\Copyright", :
s_variable = GetMetadata$(table_name, \Copyright)
Metadata , ,
.
, , Metadata.
: table_name ,
.
. ,
; ,
.
Metadata Table table_name
SetKey \Info\Author To
.
Metadata Table table_name
Dropkey \Info\Author
. , \Info\
, .
Metadata Table table_name
Dropkey \Info Hierarchical
Metadata, ,
. Save.
Metadata, ,
. :
Metadata Table ... SetTraverse
.
Metadata Table ... Next,
. .
. ,
.
Metadata Traverse ... Destroy.
:
Sub Print_Metadata(ByVal table_name As String)
Dim i_traversal As Integer
138
7:
Dim s_keyname, s_keyvalue As String
. \
,
Metadata Table table_name
SetTraverse \ Hierarchical Into ID i_traversal
:
Metadata Traverse i_traversal
Next Into Key s_keyname Into Value s_keyvalue
Do While s_keyname <>
Print
Print : & s_keyname
Print : & s_keyvalue
Metadata Traverse i_traversal
Next Into Key s_keyname Into Value s_keyvalue
Loop
:
MetaData Traverse i_traversal Destroy
End Sub
Metadata MapBasic
MapBasic.
139
7:
(seamless) ?
. ,
.
, . MapInfo.
?
MapInfo MapBasic
(SEAMMGR.MBX), .
, ,
:
, , HIGHWAY.
.
> > ,
HIGHWAY.TAB
> ,
.
, .
. . .
. . .
. ,
.
140
7:
.
, , ,
.
,
.
.
-,
(M).
, MapInfo M. MapInfo
,
.
MapBasic
Set Table , .
, ,
.
TableInfo( , TAB_INFO_SEAMLESS ), ,
.
GetSeamlessSheet( ),
.
(
, , ...).
, MapInfo
. :
.
MapBasic Find ; Find
.
.
.
141
7:
,
MapInfo ( , , ).
, MapBasic
Oracle Sybase.
MapBasic, ,
Server, Unlink.
MapBasic.
MapInfo MapBasic
SQL- . ,
.
( )
. MapBasic .
.
, ()
.
( ) SQL-.
MapBasic .
Server_Execute( ),
SQL-. ,
SQL-, , Fetch Close
Select.
, MapBasic SQL
, ,
Server_Connect. ,
(hdbc) SQL-DataLink
.
Dim hdbc As Integer
hdbc = Server_Connect(QELIB, DBMS=ORACLE7;DLG=1)
(commit) (rollback),
, .
, ,
.
:
Server hdbc Disconnect
142
7:
,
SQL MapBasic Server. ,
(, Server_NumDrivers( )),
(, Server Commit),
(, Server Fetch).
:
Server_NumDrivers()
Server_DriverInfo()
:.
hdbc=Server_Connect(toolkit,connect_string)
.
hstmt=Server_Execute(hdbc,sql_string)
.
Server hstmt Bind Column
Server_EOT(hstmt)
Server_NumCols(hstmt, ...)
Server_ColumnInfo(hstmt, ...)
(download) ODBC- ,
, , Into
MapBasic Server Fetch.
.
.
143
7:
MapInfo,
.
. ;
.
Automatic/Interactive Commit Table. ,
, ,
.
MapBasic Server Link Table.
,
, .
.
,
. MapBasic Server Refresh.
MapBasic Unlink.
.
MapInfo.
MapInfo
;
SDO Oracle. . E.
,
Register Table . Type ODBC, Register Table
MapInfo , ODBC
(_.TAB).
144
7:
, MapInfo, MapInfo
, .
.
; , MapBasic
, ,
:
( Commit).
, ,
100 .
.
Set Table ... FastEdit,
. ,
, . .
MapBasic. . Set Table ... Undo Off.
,
. , Select
, , Where,
Order By Group By.
.
, MapInfo
.
,
, , :
( Drop Index).
.
.
, Create Index.
, MapInfo
.
145
7:
Select Where,
, (. MapBasic). ,
Select Select
... Where.
:
...
Where
x = Any(
Select ...)
...
MapInfo , x
.
Select
Select . .
Select MapBasic .
146
/
8: /
MapBasic
MapInfo. , MapBasic
; , .
. . .
/ ................................................................
/ ...................................................
..............................................
....................................................
.....................................................................
.....................................
, /............
147
148
150
152
152
153
154
8: /
/
/ ( i/o)
() / ().
MapBasic BASIC / ,
/ . ,
MapInfo MapBasic ,
, / MapBasic
.
: , .
,
:
. , 50
, 50 ..
.
. ,
80 , .
()
. , ,
MapInfo
( ).
;
, .
,
. MapBasic Open File.
,
.
:
Open File "settings.txt" For Input As #1
; 1.
, Open
File. ,
String, Line Input Line Input
(#1), Open File:
Line Input #1, s_nextline
, ,
.
148
8: /
.
Open File For Output:
Open File "workfile.txt" For Output As #2
, Open File.
(#) .
, , ,
";
Close File. ( MapBasic Save
File, ,
.)
,
/. , , Open File
,
" ". , . ,
,
. ,
/,
,
,
(, ).
() 5.
,
. , , Open File,
FileExists( ), , , .
, ,
, TempFileName$( ).
149
8: /
/ :
Kill .
Save File .
Rename File .
ProgramDirectory$( ), HomeDirectory$( )
ApplicationDirectory$( )
DOS- . ,
,
MapInfo (, STARTUP.WOR), DOS-
. ProgramDirectory$( ) ,
MapInfo.
(/
), ,
For Open File: Input, Output Append.
, For Input.
, NVIEWS.MB
:
Open File view_file
For Input As #1
"view_file" .
, Input #
Line Input #. Line Input #
String. Input #
, , . ,
NVIEWS.MB :
"New York", -75.75, 42.83, 557.5
"Texas", -100.2, 31.29, 1200
,
X Y, . NVIEWS.MB Input
# ,
:
Input #1, vlist(tot).descript,
vlist(tot).x,
vlist(tot).y,
vlist(tot).zoom
"vlist" , .
150
8: /
.
, ,
. ,
EOF( ) (endoffile ) . EOF( )
FALSE, (
). EOF( ) TRUE,
.
: ,
" ". EOF( ) TRUE ,
.
, , ,
Open File For Output For Append. ,
, Write # . Write #
, .
, NVIEWS.MB Write # (
) (, X, Y ):
Write #1, vlist(i).descript, vlist(i).x, vlist(i).y, vlist(i).zoom
Write # ,
(New York"...). Write #,
. , Print # Write #.
String, Line
Input #. Print # ,
Line Input #. Print # Line Input #
- AUTO_LIB.MB.
AUTO_LIB MapInfo (
, STARTUP).
, ,
, .
151
8: /
, For
Random Open:
Open File "datafile.dat" For Random As #1 Len = 80
Random
Len. ,
. Len ( 80)
(
).
Get Put; . MapBasic.
.
, :
Open File "settings.dat" For Binary As #1
, Get Put;
. MapBasic.
. , ( Integer)
, . ,
111222333, , .
. ,
,
.
, ,
. ,
. , DOS ,
, , Macintosh
UNIX- .
- , Macintosh, MapInfo
Windows .
ByteOrder Open File. ByteOrder
, .
Open File "datafile.dat" For Binary As #1 ByteOrder LowHigh
ByteOrder , MapBasic ,
,
. , MapInfo Windows, Macintosh,
ByteOrder HighLow, MapInfo,
.
152
8: /
,
Windows, UNIX, Macintosh, ByteOrder.
ByteOrder Open File,
ByteOrder (, LowHigh),
.
,
.
,
, Open File
CharSet.
. ,
A" 65.
( ) ,
.
. ,
Windows 176
153
8: /
, CharSet,
CharSet MapBasic.
,
/
,
/ :
,
Open File. MapBasic.
154
9:
MapBasic
, , , , ,
, , ,
. , MapBasic
, . ,
MapInfo ,
MapBasic . 7,
.
. . .
...............................................................
Object ............................................................
Obj" ...........................................................
..................................................
..........................................................
.....................
.................................................................
.................................................................
...............................................
............................................................
155
156
156
158
164
167
168
170
174
177
9:
Object
Object MapBasic
( ), (, ).
Object ,
: Object,
,
Object MapInfo.
- Dim:
Dim Myobj, Office As Object
,
. Object
.
(=) -, :
Office = CreatePoint(73.45, 42.1)
Myobj = Office
, -,
, ,
_. Obj. Object MapBasic .
- . ,
Object,
(..
), (, ). MapBasic
(Pen, Brush, Symbol Font),
() .
Obj"
Obj
. ,
, Obj, Obj
. : _.obj
_.object.
Object (current_state),
STATES .
Dim current_state As Object
Open Table "states"
Fetch First From states
current_state = states.obj
156
9:
,
. SQL-,
(Update) () ,
. ,
; Obj
Area( ):
Select state, Area(obj, "sq mi")
From states
,
California ( ):
Select Sum(ObjectLen(obj, "mi"))
From highways
Where obj Within (Select obj From states Where state = "CA")
. ,
MapInfo,
; ,
, .
, , Not obj
Where Select. , ,
:
Select *
From sites
Where Not obj
Object
. ,
, MapInfo,
.
, Create Map,
(Object).
Obj , Drop Map. ,
Drop Map .
, Obj;
" . Obj, ,
Delete Object.
, ,
TableInfo( ) TAB_INFO_MAPPABLE.
, Object
.
, .
, Object,
(
, From Select).
157
9:
, ,
: STATES OUTLETS,
, . From
Select . STATES
, STATES.
Select *
From states, outlets
Where states.state = outlets.state
Map From selection
From OUTLETS (.
), Select , (
), :
Select *
From outlets, states
Where outlets.state = states.state
Map From selection
.
. ""
();
(). ,
. ,
,
MapInfo > .
, ObjectInfo( )
TAB_INFO_NPOLYGONS.
MapInfo . ,
. ,
ObjectInfo( ) OBJ_INFO_TYPE.
ObjectInfo( ) MapBasic.
MapBasic
. , MapBasic,
:
Fetch First From world
Note world.obj
Text .
Select *
From Layout1
Where Str$(obj) = "Text"
,
ObjectGeography( ). , X Y
, ObjectGeography( ).
158
9:
,
.
ObjectNodeX( ) ObjectNodeY( ).
Centroid( )
CentroidX( ) CentroidY( ).
MBR( ).
ObjectInfo( ). ,
Object, ObjectInfo( ),
(, ..), ObjectInfo( ),
(Pen, Brush, Symbol Font). ObjectInfo( )
, .
MapBasic
, .
, Area( ), Perimeter( ) ObjectLen( )
. (flood
, , ):
Dim floodarea As Float
Open Table "floodmap"
Fetch First From floodmap
floodarea = Area(floodmap.obj, "sq km")
, .
Brush
, .
Font
, , , , ; .
Symbol
MapInfo 3.0: , , .
TrueType: , , , ,
(, ), .
, :
, , .
159
9:
, , ,
() . , Create Line
Pen , , .
, MapInfo .
: =, . ,
, Brush,
.
Dim b1, b2 As Brush
b1 = MakeBrush(2, 255, 0)
b2 = CurrentBrush()
If b1 = b2 Then
Note .
End If
runtime ,
Brush. , StyleAttr (),
(, ..) .
().
( Times, Roman Baltica), ( , ,
..) . ; ,
.
,
. 10 ,
10 .
10 , , 10
.
, MapInfo
. ,
Create Text.
Create Text, x y,
; . -
, ,
, , , .
,
. .
, -, ,
. .
, Courier Helvetica.
; , Geneva
Macintosh, . Helv TmsRmn ( Times New Roman)
Microsoft Windows Helvetica Times Sun Macintosh.
160
9:
Helvetica, Times Courier MapBasic Font
.
MapBasic : Pen, Brush, Symbol Font,
.
:
, Pen
MakePen( ). Pen Pen.
Dim p_var as Pen
p_var = MakePen(1, 10, RGB(128, 128, 128))
MakePen( ) : 1 ,
; 10 (dotted); RGB( )
. , (
), " Pen" MapBasic.
, Brush, Font Symbol ,
Brush , Font Symbol MapBasic.
, Pen
:
p_var = ObjectInfo(obj_var, OBJ_INFO_PEN)
161
9:
Pen,
:
Create Line Into Variable obj_var
(-73, 42) (-74, 43)
Pen p_var
StyleAttr( ) . ,
TEXTBOX ,
; Pen,
"pstyle". TEXTBOX ,
Integer (line_color):
line_color = StyleAttr(pstyle, PEN_COLOR)
MapInfo . ,
0, 255. RGB( ) MapBasic
, . ,
RGB(0, 255, 0) .
RGB( ). :
highway_style = MakePen(2, 2, RGB(0, 0, 255))
RGB( )
(BLACK, WHITE, RED, GREEN, BLUE, YELLOW, CYAN
MAGENTA), MAPBASIC.DEF.
ObjectInfo( ) Pen, Brush, Symbol Font
. Pen, Brush, Symbol Font,
StyleAttr( ),
(, Symbol).
Select, , .
, Where Select
ObjectInfo( ) StyleAttr( ), MapInfo ,
(, ).
.
,
, .
162
9:
Include mapbasic.def
Declare Sub Main
Declare Sub SelectPointsByColor()
Sub Main
.
Alter ButtonPad Add
PushButton
Calling SelectPointsByColor
HelpMsg \n
End Sub
Sub SelectPointsByColor
Dim i_color, i_open As Integer
Dim symbol_style As Symbol
Dim object_name, table_name As String
?
i_open = NumTables()
.
table_name = SelectionInfo(SEL_INFO_TABLENAME)
If table_name = Then
... ; .
Exit Sub
End If
, .
If Not TableInfo(table_name, TAB_INFO_MAPPABLE) Then
Exit Sub
End If
- ?
, .
Fetch First From Selection
object_name = Str$(Selection.obj)
If object_name = Point Then
symbol_style = ObjectInfo(Selection.obj,OBJ_INFO_SYMBOL)
i_color = StyleAttr(symbol_style, SYMBOL_COLOR)
End If
1 ( 2...).
.
If NumTables() > i_open Then
Close Table TableInfo(0, TAB_INFO_NAME)
End If
If object_name <> Point Then
... - , .
Exit Sub
End If
163
9:
.
Select * From table_name
Where Str$(Obj) = Point
Into Color_Query_Prep
NoSelect
.
Select * From Color_Query_Prep
Where
StyleAttr(ObjectInfo(obj,OBJ_INFO_SYMBOL),SYMBOL_COLOR)
= i_color
Into Color_Query
Close Table Color_Query_Prep
End Sub
,
. , , "Region" "Point",
ObjectInfo() OBJ_INFO_BRUSH OBJ_INFO_SYMBOL, ..
MapBasic ,
. ;
MapBasic.
.
, Create Frame, .
164
Create Arc: .
Create Ellipse: . (
, .)
Create Frame: . ,
; . ,
, .
Create Line: .
Create Point: .
Create Pline: .
Create Rect: .
Create Region: ().
Create RoundRect: .
Create Text: .
9:
, AutoLabel (.. )
. AutoLabel MapInfo 3.0 >
.
MapBasic Object:
CreateCircle( ): .
CreateLine( ): .
CreatePoint( ): .
,
,
. , Update CreateCircle( )
, :
Update sites
Set obj = CreateCircle(lon, lat, 0.1)
, sites "lon"
( X) "lat" ( Y).
, .
( 32,763 ).
Create Region. Create
Region .
, . ,
, ,
.
, ,
, .
() :
1. Create Region Create Pline,
( ).
2. Alter Object,
. Alter Object ,
.
165
9:
:
Include "mapbasic.def"
Type Point
x As Float
y As Float
End Type
Dim objcoord(5) As Point
Dim numnodes, i As Integer, myobj As Object
numnodes = 3
set CoordSys Earth
objcoord(1).x = -89.213 objcoord(1).y = 32.017
objcoord(2).x = -89.204 objcoord(2).y = 32.112
objcoord(3).x = -89.187 objcoord(3).y = 32.096
Create Pline Into Variable myobj 0
For i = 1 to numnodes
Alter Object myobj Node Add (objcoord(i).x,objcoord(i).y)
Next
Insert Into cables (obj) Values (myobj)
, Object,
. ,
, .
, Insert
Update. , ,
.
Update
. ,
. Update ;
,
"Obj". , "Obj"
SITES:
Update sites
Set Obj = CreatePoint(x, y)
Where RowID = 1
Insert . Insert
. SITES,
"Obj" "":
Insert Into sites (Obj)
Values (CreateLine(x1, y1, x2, y2))
166
9:
TEXTBOX Insert, Update.
TEXTBOX ( "")
;
Insert. , "
",
Update
.
Insert Update
.
( "Obj"); , Insert Update
. Insert Update
MapBasic.
MapBasic
.
MapBasic;
MapBasic.
( "") ,
, ,
. , ,
, 300 .
Create Object. , 300
,
:
Dim danger_zone As Object
Create Object As Buffer
From selection
Into Variable danger_zone
Width 300 Units "m"
Select * From dig_sites Where dig_site.obj Within danger_zone
MapBasic Buffer( ), ,
.
,
Create Object .
Create Object As Merge, MapInfo
, ().
(,
167
9:
), .
.
, STATES:
Select *
From states
Where state ="CA" Or state = "NV"
Create Object As Merge
From selection
Into Table territory
Merge () "
" (XOR). , ,
,
(.. ).
.
. :
Select * From Territory Where TerrName = "Western Territory" or
TerrName = "NV"
Delete From selection
MapBasic ,
. ,
,
:
1. . ( ,
Object, Fetch,
,
_ = _.obj).
2. , .
( Alter Object.)
168
9:
3. Update,
.
TEXTBOX .
" ",
TEXTBOX Alter Object
, Update ,
.
, Alter
Object Geography.
Alter Object (, X,
Y).
, Font
( Alter Object Info).
, X Y
( Alter Object Geography).
()
ConvertToRegion( ).
ConvertToPline( ).
MapBasic.
169
9:
()
:
Overlap( )
Object.
.
Erase( )
Object.
, ,
.
Objects Erase (),
"", .
Objects Intersect (),
"",
.
,
Alter Object. Alter Object ,
. ,
Objects Overlay OverlayNodes( ).
IntersectNodes( )
. IntersectNodes( ) ,
. ObjectInfo( ) .
, ObjectNodeX( )
ObjectNodeY( ).
MapInfo, AutoLabel,
. MapInfo 4.0
:
, . ,
, MapBasic 3.x,
; MapInfo 4.0 AutoLabel .
170
9:
MapInfo
. MapBasic
Set Map ... Label.
Set Map
Layer 1
. MapBasic
:
Set Map
Layer 1
Layer 1
MapInfo
, > .
MapBasic :
Set Map
Layer 1
Label Default
MapInfo . ,
, , ,
DEL. .
, , MapBasic,
Set Map ... Label,
Object. , :
Set Map Layer 1 Label
Object 1 Visibility Off
Object 3 Visibility Off
Object. , Object 1
, Object 3
.
, Save
Workspace.
: ,
.
, , Set Map ...
171
9:
Object. Object .
, ,
.
, ,
, , .
, ,
.
(
), .
Set Map
MapBasic, ,
:
1. MapBasic.
2. .
3. > .
4. OK.
MapInfo Set Map MapBasic.
MapBasic .
MapBasic,
, :
( , ..).
.
, MapBasic
( Set Map ... Layer ... Label ... Object ).
.
MapBasic,
Create Text, AutoLabel
,
:
Set Map
MapBasic,
,
:
Set Map
Alter Object
MapBasic,
ObjectInfo( ),
, ObjectGeography( )
(,
):
172
MapBasic
.
9:
MapBasic,
,
:
Select
MapBasic
.
,
.
.
(
,
).
MapBasic:
,
x y,
;
.
.
.
.
, .
,
, .
/.
.
, .
. ,
WORLD, , :
Set Map Layer 1 Label Object 1
Visibility On
Anchor (0, 85)
(x,y)
Text Map of World
Position Center
173
9:
:
, ,
, .
. :
( Create Table), .
, ,
. (
Create Map).
( Add Map). Set
Map, (, Auto On, ..).
, ,
( 31 )
( 1). , . ( ,
, .
COGOLINE.MB , - .)
, Set Map ... Object,
. ,
. , , ,
.
MapBasic
. MapBasic ,
.
:
174
, ,
, MapBasic .
9:
. MapBasic
.
, , ,
MapBasic . Set
CoordSys Nonearth.
, , ,
MapBasic .
Set CoordSys Layout.
MapBasic CoordSys,
.
(, ). , MapBasic
, MapInfo .
MapBasic ,
Set CoordSys Layout :
Set CoordSys Layout Units "in"
. , Create Text .
, Set CoordSys ,
, . MapBasic
.
Set CoordSys,
.
175
9:
MapBasic ,
MapInfo. / (NAD 1927) (
, , .)
MapBasic ,
MapBasic Set CoordSys. ,
Centroidx( ) (
), ,
.
, , ,
: WY -107.554 43, Wyoming:
Select state, CentroidX(obj), CentroidY(obj)
From states
Where state = "WY"
: WY -934612.97 2279518.38;
.
Set CoordSys Earth Projection 9, 62, "m", -96, 23, 29.5, 45.5, 0, 0
Select state, CentroidX(obj), CentroidY(obj)
From states
Where state = "WY"
MapBasic, :
Set CoordSys Earth
MapBasic :
, , .
, MapBasic,
Set Area Units MapBasic. Area( )
,
.
, , .
, MapBasic, Set
Distance Units MapBasic.
, . ,
Set Window
, ,
.
MapInfo
, , . ,
, , . ,
, . :
obj_var = CreateCircle(x, y, 5)
176
9:
MapBasic ,
. ,
Set Distance Units, (5)
. , 5
:
Set Distance Units "km"
obj_var = CreateCircle(x, y, 5)
, Set Area
Units, Set Paper Units .
MapBasic
, . ,
Add Column ,
,
.
, MapBasic MapInfo
, , MapBasic
. 7 ("
").
MapBasic (=)
(If object_a = object_b). MapBasic
,
. MapBasic Contains, Within
Intersects, Part Entire
.
If...Then:
If Parcel_Object Within Residential_Zone_Obj Then
Note " ."
End If
Select:
Select * From wetlands
Where obj Contains Part myproject
, Within Contains,
: (), ,
.
: Within Contains,
. :
177
9:
Within , -
.
Contains , .
, :
Within () .
Contains () .
,
:
Select * From states
Where obj Contains distribution_ctr
:
Select * From landfill
Where obj Within county_obj
Within Contains ,
. , ,
Entire(ly). Part(ly) ,
, .
,
:
Select * From highway
Where obj Partly Within countyobj
Partly Within , ,
, ( ).
Entirely Within ,
.
,
, Partly
Entirely .
Intersects .
,
, , . ,
, . , ,
, .
MapBasic:
178
9:
TRUE, :
Contains
A B
Contains Part
A B
Contains Entire
A B
Within
A B
Partly Within
A B
Entirely Within
A
B
Intersects
MapBasic
( "Object").
, , -.
( Entirely Within).
ObjectLen( )
, 300 :
Select *
From cable
Where ObjectLen(obj, "m") > 300
Indiana:
Select Sum(Area(obj,"sq mi"))
From wetlands
Where obj Within (Select obj From states Where state = "IN")
"lon"
"lat":
Set Distance Units "km"
Select * From tanks Where obj Within
CreateCircle(lon,lat, 1)
,
( , ):
Select
Name, Distance(Centroidx(obj), Centroidy(obj),
office_lon, office_lat, "km")
From employee
Order By 2 Desc
179
9:
SQL-
()
MapBasic
. , , ,
Marion Indiana.
(DOCTORS), (COUNTIES).
, ,
,
. :
Dim mycounty As Object
Select *
From counties
Where name="Marion" and state="IN"
Fetch First From selection
mycounty = selection.obj
Select *
From doctors
Where obj Within mycounty
Where , .. ,
"mycounty", ,
:
Select *
From doctors
Where obj Within
(Select obj From counties Where name="Marion" And state="IN")
, ( Select, )
,
, Marion Indiana. MapInfo
(DOCTORS), , Marion.
,
("mycounty"), .
, ( )
"Object", Select
"obj". ,
, "Object".
, Any( ).
,
Any( ).
$15000.
.
Select *
From doctors
180
9:
Where obj Within
Any (Select obj From counties Where inc_pcap < 15000)
Select: , . ,
, -:
Select *
From counties
Where obj Contains
(Select obj From doctors Where specialty = "Neurology")
, Nebraska:
Select *
From states
Where obj Intersects (Select obj From states Where state = "NE")
,
. ,
,
. MapBasic
,
. ,
,
.
MapInfo . ,
, ID,
:
. ,
, .
,
(, ,
). ,
. SQL Select
:
Select *
From projects, congdist
Where projects.obj Within congdist.obj
Update, ( "name") (
"cd"):
Update Selection Set cd = name
,
.
181
9:
:
Select congdist.name, sum(project.amt)
From congdist, project
Where congdist.obj Contains project.obj
Group By 1
Where ,
Within Contains.
Add Column
() ,
,
. , ,
( ).
,
. Add Column
,
, .
Add Column . MapBasic.
182
9:
10
MapBasic- ,
MapInfo (Windows 3.x, Windows95,WindowsNT Macintosh).
, MapBasic,
MapInfo Windows, MapInfo Macintosh.
, ,
. ,
.
(, MapInfo Windows), .
. . .
.................................
, - .
.....................................................................
......................................................
...................................................................................
.....................................
..........................................
....................................................
.......................................
183
184
185
186
186
187
187
187
188
10:
, -
MapInfo Macintosh:
AEExecute( )
AEInitiate( )
MapInfo Windows:
DDEExecute
DDEInitiate( )
DDEPoke
DDERequest$( )
DDETerminate
DDETerminateAll
Set Application Window
Set Next Document
MapBasic .
MapBasic Macintosh DDE-,
. ,
MapInfo Macintosh, DDE- , DDE
Macintosh.
SystemInfo( ) MapBasic
, .
SystemInfo( ) ,
.
,
. ,
Min, , :
Browse
Graph
Layout
Map
Set Window
Macintosh , Min
MapInfo Macintosh.
, MapInfo Windows,
7000 . , Windows95, WindowsNT
Macintosh, 32767 .
184
10:
, MapBasic, ,
. , Ask ( ),
, MapInfo Windows,
Windows (,
, Windows).
MapInfo Macintosh, ,
Macintosh (, Macintosh).
Dialog, ,
Macintosh. ,
Macintosh (, PowerBook),
290 155
. , MapBasic Macintosh
XCMD-, .
Macintosh 20% ,
Windows. , Macintosh
, Windows.
,
"OK "Cancel ("" ) . Windows "OK
"Cancel , "OK "Cancel;
Macintosh "OK "Cancel.
TEXTBOX ( ) ,
, , "OK "
, .
TEXTBOX MapBasic ,
( SystemInfo( )),
(shift_ok shift_cancel) ,
Macintosh. Dialog OKButton
CancelButton , :
Control OKButton
Title "OK"
Position 90 + shift_ok, 180
Control CancelButton
Title ""
Position 90 + shift_cancel, 180
, Windows, OK
; Macintosh, OK
.
185
10:
, ,
, () . ,
,
.
.
, ,
, Courier, Times
Helvetica. , MapBasic
. MapBasic
CreateText Times, MapBasic
Times Roman, ,
TmsRmn, Times New Roman
Times Roman.
. , PC,
VGA-,
(dithering). Macintosh ,
. PC VGA- MapInfo
; -
, - .
Macintosh PC-
.
,
, .
186
10:
(, , ) ,
.MBX- . , ,
MapBasic Windows,
.MBX- Macintosh uj MapInfo
Macintosh.
: .MBX- ( ) , .MBO ( ) .
(.MBO-),
.
Asc( ) Chr$( ) () .
,
- .
, ,
, , Chr$( ).
, , MapBasic Windows, -
( Windows Latin 1 176,
Windows, NUMLOCK, ALT
0, 1, 7, 6). , MapBasic Windows.
MBX. MapInfo Windows, ,
(176) .
MBX Macintosh MapInfo Macintosh.
MapInfo ,
Macintosh.
Macintosh .
DOS-
Windows DOS . DOS : , ;
, ; , ,
. . Open Table
DOS-:
Open Table "C:\MAPINFOW\DATA\STATES.TAB" As States
187
10:
Macintosh .
"MAX" .
,
MapBasic: PathToFileName$( ), PathToDirectory$( )
PathToTableName$( ). , ,
.
HomeDirectory$( ), ProgramDirectory$( ), FileOpenDlg( ) FileSaveAsDlg( )
. ,
, ,
.
,
,
(, STATEMAP.TAB").
Windows Macintosh;
UNIX . ()
, UNIX.
,
, ASCII ( 32 126),
CharSet,
.
, /, Open File;
CharSet,
.
Open File ByteOrder, ,
, .
,
.
Open File MapBasic.
188
MapBasic
MS Windows
11: MapBasic MS Windows
11
, MapBasic ,
Windows. :
(DLL).
.
(DDE).
.
MapBasic Windows
. 11
.
. . .
MapBasic MS Windows ....................................
(DLL) .............
16- 32- DLL ..............................................
.........................
DDE .........................
...................
189
190
194
197
200
206
(DLL)
Windows (Dynamic Link Library, DLL) ,
. DLL-
MapBasic
Call.
DLL- , .
, . ,
DLL- MapBasic-,
Declare , . Declare
DLL-, .
Alias , , DLL-
.
DLL- , MapBasic,
c Declare Function . (.
MapBasic Declare Sub Declare Function.) DLL-
.
DLL- Windows Software Developer's
Kit (SDK), .
Lib libname Declare MapBasic,
"libname". Windows
, . libname
User, GDI, Kernel DLL- Windows.
DLL- libname DOS:
Declare Sub mydll Lib "C:\dlls\mydll.dll" (ByVal x As Integer,
ByVal y As Integer)
190
DLL- , ,
DLL- .
MapBasic : (by value),
MapInfo , (by reference), MapInfo
MapBasic; DLL .
4.
ByVal (by value).
ByVal Declare,
, .
(by reference) , ,
.
MapBasic : ,
() .
, , DLL .
. .
, MapBasic
MessageBeep Windows- User.
Declare Sub MessageBeep
(ByVal x As SmallInt)
Lib "user"
, Declare
user, user.dll. :
GDI Kernel.
DLL- Declare Sub
Call:
Call
MessageBeep(1)
DLL- Alias
DLL- MapBasic. ,
DLL- -
MapBasic. , Alias DLL. , Beep
MessageBeep User:
Declare Sub Beep Lib "user"
(ByVal x As SmallInt)
Alias "MessageBeep"
Call Beeper(1)
191
DLL- MapBasic
. DLL- C ,
MapBasic ,
- char *.
: MapBasic , DLL-
. , DLL-
, MapBasic .
MapBasic ,
. , - , DLL-
. , MapBasic 20 , DLL- .
MapBasic DLL-, MapInfo
ANSI- , , .
DLL- -, ,
.
, (.. ) 100
, MapBasic 100 ,
DLL-. MapBasic String$( )
.
(, Dim stringvar As String * 100). MapBasic
, , .
MapBasic DLL- ,
sub- MapBasic. DLL,
,
.
,
DLL- ,
Type. MapBasic , ,
. , DLL ,
(structure packing").
MapBasic DLL,
.
192
: KERNEL
DLL- Windows-
KERNEL. Windows,
WIN.INI.
Declare Sub Main
'
' Windows- "KERNEL".
Declare Function GetProfileString Lib "kernel"(
lpszSection As String,
lpszEntry As String,
lpszDefault As String,
lpszReturnBuffer As String,
ByVal cbReturnBuffer As Smallint) As Smallint
Sub Main
Dim sSection, sEntry, sDefault, sReturn As String
Dim iReturn As Smallint
' "sCountry"
' "[intl]" WIN.INI.
sReturn = String$(256," ")
sSection = "intl"
sEntry = "sCountry"
sDefault = "Not Found"
iReturn = GetProfileString(sSection, sEntry, sDefault, sReturn,
256)
' sReturn
' (, "United States")
Note "[" + sSection + "]" + chr$(10) + sEntry + "=" + sReturn
End Sub
16 MapInfo, DLL,
MapBasic-, 16.
, 16
MapInfo 32 Windows.
32 MapInfo, DLL,
MapBasic-, 32.
, DLL
.
MBX- "16" "32" , ..
.
MapBasic
16 Windows,
32-. ,
, , 16-
32- DLL.
MapBasic DLL, ,
Windows:
1. 16 32 DLL.
2. MapBasic Declare
16- DLL .
3. MapBasic Declare
16- DLL .
, 16- DLL, Alias,
.
4. SystemInfo(SYS_INFO_MIPLATFORM).
, DLL .
.
5. MBX- DLL.
194
195
Then
Sub DoIt
,
...
End Sub
DLL
, DLL-
.
196
C++ DLL, ,
.
( C).
16 Windows DLL
Pascal ( __pascal), - C
( __cdecl). MapBasic ,
.
Microsoft C (32) :
( __stdcall), C ( __cdecl)
( __fastcall). MapBasic
.
(),
, C ( ).
MapBasic ( ), .
,
(, double).
;
.
: DLL
.
, Declare ,
DLL
( ,
).
MapBasic MapInfo.
6.
.
. Windows BMP- DLL-;
Macintosh PICT-; UNIX
XPM-. , MapInfo
Windows.
MapBasic (
, ). ,
MapInfo Windows.
()
,
MapInfo. 4.0, MapInfo
,
.
, Icon Sampler
(ICONDEMO.MBX).
.
197
Windows
MapInfo Windows .
MapBasic , MapBasic
, , ,
AppStudio (
Microsoft Visual C).
Windows DLL.
, DLL-
. DLL- " (.. ,
).
.
18 16 ;
.
26 24 ;
(, 1024 x 768). ,
. MapInfo
> .
:
DLL-, .
DLL- , , AppStudio.
(BMP-):
18 16 26
24 .
, , .
(ID) . ,
ID 100 18 X 16 , 26 x 24
ID- 101.
, MapBasic
Create ButtonPad Alter ButtonPad.
(18 16) . , ID 100 101 , 100,
:
Alter ButtonPad ""
Add PushButton
Icon 100 File "MBICONS1.DLL"
HelpMsg " "
Calling new_route
Show
198
Windows
, . , , ,
, (hot spot").
CURSOR- DLL-.
DLL- CURSOR-, BMP-.
DDE
. Windows
, DDE.
Windows DDE,
. , Windows- Microsoft Excel,
MapInfo (, Map From world).
DDE-
DDE- , Windows.
, DDE.
; ,
(MapInfo, Excel ) .
; .
. , , .
; , - .
.
MapBasic DDE-
MapBasic ,
MapBasic DDE-.
199
;
;
;
DDE-.
. MapBasic.
, DDE-, DDEInitiate( ).
DDEInitiate( ) : application
topic.
application (, Excel DDE-
Microsoft Excel). topic . ,
topic , -.
, Excel TRIAL.XLS, MapBasic
:
Dim channelnum As Integer
channelnum = DDEInitiate("Excel", "TRIAL.XLS")
DDEPoke ,
( R1C2, .. 1, 2).
DDE- ,
( MapBasic), DDETerminate
DDETerminateAll. DDETerminate DDE-;
200
;
( ). -
DDE-, ,
.
MapInfo DDE-
MapInfo , Windows- DDE. - MapBasic,
MapBasic .
Windows-, DDE,
MapInfo, , , . ,
MapBasic MapInfo .
DDE- . ,
DDE-.
, DDE- MapBasic,
application, topic item, .
DDE- MapInfo , MapInfo"
application.
topic System"
MapBasic (, C:\MAPBASIC\GRIDS.MBX").
.
item (topic).
, , MapInfo
DDE-.
Application:
MapInfo
Topic:
System
, DDE:
item
201
item
SysItems
Sysitems
MapInfo
System: Sysitems Topics Formats
Topics
Topics
MapInfo
(System MapBasic,
).
Formats
Version
Formats
MapInfo
MapInfo
Clipboard (TEXT ).
MapInfo ,
MapInfo,
100. , MapInfo 4.0.0
"400". . .
MapBasic
Execute
MapInfo
MapBasic .
If , MapInfo
.
MapInfo 4.0.
MapInfo
MapBasic,
MapBasic.
() ,
.
,
(.MB-).
,
Dim MapBasic.
, MapBasic-,
MapBasic, DDE-, "MapInfo"
application "System" topic.
Dim i_channel As Integer
i_channel = DDEInitiate(MapInfo, System)
Print DDERequest$(i_channel, Version)
DDETerminate i_channel
202
Application:
MapInfo
Topic:
MapBasic-
, DDE:
item
{items}
MapInfo
,
. .
.
MapInfo ,
.
MapBasic
RemoteQueryHandler( ), MapInfo .
item :
CommandInfo(CMD_INFO_MSG)
MapInfo 4.0.
(Poke)
MapInfo
.
Execute
MapBasic
RemoteMsgHandler, MapInfo
.
CommandInfo(CMD_INFO_MSG).
, MapBasic,
MapBasic-, DDE ,
"SCALEBAR.MBX" topic.
,
SCALEBAR.MBX. : ,
SCALEBAR.MBX .
Dim i_channel As Integer
i_channel = DDEInitiate(MapInfo, SCALEBAR.MBX)
203
MapInfo DDE-Execute
,
MapInfo :
DDE- " System " topic
, MapInfo
MapBasic.
MapBasic topic,
, MapInfo
RemoteMsgHandler ,
CommandInfo () .
MapBasic DDE-,
. MapBasic
MapBasic MapInfo.
DDE-
/ Excel DDE-
DDEInitiate( ) MapBasic.
Watcher (WATCHER.MB), ,
DDE-. WATCHER :
MapBasic Watcher,
Excel ,
. , WATCHER
Excel.
WATCHER DDE-:
204
WATCHER DDE-,
MapBasic, (topic).
DDERequest$( ), .
, , WATCHER , Excel.
DDEPoke, WATCHER , Excel,
Excel.
OS/2
MapInfo DDE- DDE-,
OS/2. :
DDE
MapInfo DDE-,
"", "" . Windows
DDE-, MapBasic, Windows
.
MapBasic DDE-,
.
,
. ,
. MapBasic .
Windows (Microsoft Windows Help Compiler),
Microsoft Corp.
MapInfo Windows,
MapInfo Macintosh MapInfo UNIX.
.
Open Window,
Close Window Set Window. ,
(Contents):
Set Window Help
Contents
Set Window - (.
MapBasic). Set Window
205
File C:\MAPINFO\DISPATCH.HLP
,
500:
Set Window Help
ID 500
(ID-) [MAP] -
( filename.hpj).
Windows Software Developers Kit (SDK).
, ,
(Button control) Help"
:
Control Button
Title
Calling show_help_sub
"" -, Set
Window. , , .
- . 6.
206
12:
12
. . .
...................................................
......................................
......................
...................................
.......................
................................................................
.....................
(Callback)
MapInfo ........................................................
..................................
.................................................................
MapBasic ......................................
MapBasic OLE ....................
MapInfo .........................................
Visual C++ MFC ................................................................
- .................................
...................................
205
208
208
210
212
213
213
222
225
226
228
229
240
241
246
250
12:
?
MapInfo Professional, ,
MapBasic. ,
Visual Basic, () MapInfo , Visual Basic,
Visual Basic. , MapInfo .
, C Visual Basic, ,
MapInfo , , MapBasic.
:
, , ,
, () ,
\MAPBASIC\DOCS\UG-CH12.RTF.
.
?
.
,
MapInfo. , MapInfo, Visual Basic.
208
12:
(MDI) ,
Visual Basic,
MapInfo.
MapInfo
MapInfo, ,
- . (, ,
209
12:
). , MapInfo.
: ,
MapInfo .
MapBasic.
, C Visual Basic. Visual Basic.
, MapInfo
. , Visual Basic MapInfo CreateObject( ). MapInfo
, .
MapInfo, ,
MapBasic, MapInfo OLE (OLE Automation)
(DDE). MapInfo ,
MapBasic.
, Map From MapBasic , MapBasic-. (, Set Next Document Parent), () .
(reparenting) . , , ,
.
: MapInfo MapInfo
. MapInfo MapInfo.
210
12:
:
, MapBasic- ( .MBX) . . ,
MapBasic-, .
211
12:
MapInfo 4.0
. MapInfo .. (runtime) MapInfo ( MapInfo, ).
- (, Visual Basic)
OLE (OLE Automation controller)
(DDE-). OLE
.
- MapInfo.
(, ..), .. ,
. HWND-
.
212
12:
Visual Basic ,
MapInfo .
Visual Basic. General Declarations (
) Object. ( mi,
-.)
Dim
mi
As Object
Form_Load :
Sub Form_Load( )
Set mi = CreateObject(MapInfo.application)
mi.do Set Application Window & Form1.hWnd
mi.do Set Next Document Parent & Form1.hWnd & Style 1
mi.do Open Table World Interactive Map From World
mi.RunMenuCommand 1702
mi.do Create Menu MapperShortcut ID 17 As (-
End Sub
, MapInfo , Visual Basic ( VB- VB-),
:
MapInfo
MapInfo
CreateObject( ) Visual Basic -
213
12:
. ( ;
MapInfo .) :
Set mapinfo = CreateObject(MapInfo.Application)
MapInfo,
CreateObject( ), GetObject( ).
Set mapinfo = GetObject( , MapInfo.Application)
: Runtime- MapInfo, ,
MapInfo.Runtime MapInfo.Application. Runtime-
.
CreateObject( ) GetObject( ) OLE
(OLE Automation) MapInfo. DDE-
OLE-, Shell( ) Visual Basic
MapInfo, (property) LinkMode DDE-.
32- Windows (Windows95 Windows NT)
MapInfo. MapInfo ,
CreateObject( ),
MapInfo. 16-
MapInfo; MapInfo
, CreateObject( ),
MapInfo.
MapInfo
MapInfo , MapBasic. , MapInfo
MapBasic- Open Table VB- :
msg = Open Table RUSSIA.TAB Interactive
MapInfo, OLE
(OLE Automation), MapInfo Do. :
mapinfo.Do msg
Do MapInfo
, MapBasic.
MapInfo, (DDE), MapInfo DDE- LinkExecute.
: MapInfo, MapBasic. , MapBasic- Dialog, MapBasic.
MapBasic MapBasic
MapBasic ; 214
12:
. ,
Dialog : Dialog
MapBasic. , MapBasic,
(, For...Next Goto), MapBasic.
MapInfo
- MapBasic- VB- , . , , MapBasic- WindowID(0),
( Visual Basic):
msg = WindowID(0)
MapInfo, OLE
(OLE Automation), MapInfo OLE- Eval. :
Dim result As String
result = mapinfo.Eval WindowID(0)
Eval MapInfo
MapBasic, .
: ( Logical), MapInfo
, T F .
MapInfo, (DDE), DDE- LinkRequest.
MapInfo
MapInfo Set Application Window MapBasic
- MapInfo. ( FormName Visual Basic.)
msg = Set Application Window & FormName.hWnd
mapinfo.Do msg
, MapInfo VB-
MapInfo Set Next Document, MapBasic-,
. , MapInfo
-. ( MapFrame Picture Box ( ) Visual Basic.)
msg = Set Next Document Parent & MapFrame.hWnd & Style 1
mapinfo.Do msg
msg = Map From States
mapinfo.Do msg
12:
VB-. MapInfo ( Map, Graph, Browse, Layout Create Legend) , -
HWND .
MapInfo
Set Next Document Parent, , . MapInfo WindowID(0) ID- (Window ID) MapInfo,
MapBasic . :
mapid = Val(mapinfo.eval(WindowID(0)))
, , MapInfo .
, MapInfo .
,
.
: C,
.
WS_CLIPCHILDREN.
,
MapInfo
MapInfo , ,
, , .
,
MapBasic Set Window ... Parent. , - FindZip
:
mapinfo.do Set Window Info Parent & FindZipForm.hWnd
, , .
Set Next Document. ,
.
. , ,
. MapBasic Create Legend
.
MapBasic Window Legend Parent.
, MapBasic Set Next
Document Create Legend. , ,
.
, .
216
12:
: . Set
Next Document .
FindZip.
, ,
. FindZip
Visual Basic PictureBox, .
MDI, .
: , MapInfo
, .
, ,
, Windows API MoveWindow,
.
, Visual Basic 32-
Windows,
MoveWindow:
Declare Function MoveWindow Lib user32 _
(ByVal hWnd As Long, _
ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal bRepaint As Long) As Long
12 MapBasic WIN_INFO_WND. ,
ScaleWidth ScaleHeight Visual Basic,
.
MapInfo
MapInfo. ,
, ,
. , Visual Basic,
Visual Basic.
, Visual Basic
MapInfo, RunMenuCommand. ( ,
MapBasic Run Menu Command). , FindZip
InfoTool_Click
mapinfo.RunMenuCommand 1707
217
12:
, FindZip
MapInfo RunMenuCommand, 1707
( MapInfo).
1707 . ,
, ,
. MapBasic
M_TOOLS_PNT_QUERY, 1707. ,
:
mapinfo.RunMenuCommand M_TOOLS_PNT_QUERY
( M_TOOLS_PNT_QUERY)
. ,
, MapBasic.
Visual Basic, MAPBASIC.BAS. C
MAPBASIC.H.
MapInfo.
MAPBASIC.BAS ( Visual Basic), MAPBASIC.H ( C),
MENUS.DEF ( MapBasic).
218
1701
M_TOOLS_SELECTOR
1722
M_TOOLS_SEARCH_RECT
1703
M_TOOLS_SEARCH_RADIUS
1704
M_TOOLS_SEARCH_BOUNDARY
1705
M_TOOLS_EXPAND
1706
M_TOOLS_SHRINK
1702
M_TOOLS_RECENTER
1707
M_TOOLS_PNT_QUERY
1708
M_TOOLS_LABELER
1710
M_TOOLS_RULER
1734
M_TOOLS_DRAGWINDOW
12:
1711
M_TOOLS_POINT
1712
M_TOOLS_LINE
1713
M_TOOLS_POLYLINE
1716
M_TOOLS_ARC
1714
M_TOOLS_POLYGON
1715
M_TOOLS_ELLIPSE
1717
M_TOOLS_RECTANGLE
1718
M_TOOLS_ROUNDEDRECT
1709
M_TOOLS_TEXT
1719
M_TOOLS_FRAME
,
. 6.
,
.
MapInfo
MapInfo ,
MapInfo. .
. , , , ,
OLE-.
,
MapBasic Alter Menu ... Remove ,
Create Menu. MapBasic.
, MapBasic Alter Menu
... Add Calling OLE Calling DDE.
, MapBasic Create Menu
" (- " . ,
:
mapinfo.do Create Menu MapperShortcut ID 17 As (-
MapInfo
PrintWin MapBasic MapInfo
, .
FindZip, MapBasic. FindZip
219
12:
Print Map,
:
Private Sub Menu_PrintMap_Click( )
mapinfo.do PrintWin
End Sub
, PrintWin .
MapBasic Save Window
Windows metafile (WMF).
FindZip. PrintForm,
,
Visual Basic PrintForm.
MapInfo ,
. , Map From World ,
World . MapInfo .
MapInfo, . Visual Basic, ,
On Error.
, MapInfo,
LastErrorCode LastErrorMessage .
ERRORS.DOC.
, LastErrorCode , 1000 ,
ERRORS.DOC. , 311,
LastErrorCode=1311.
MapInfo
MapInfo CreateObject( ), MapInfo . , . Nothing:
Set mapinfo = Nothing
MapInfo (DDE),
MapInfo, DDE- LinkExecute End MapInfo MapInfo.
Visual Basic
16 Visual Basic, DDE
MapInfo, , DDE ,
. . ,
220
12:
16 Visual Basic 32 Windows (Windows95
WindowsNT).
, Visual Basic , DDE , .
MapBasic
, VB- , MapBasic, MapInfo
OLE- Do. , , ( Visual Basic &
).
Dim msg As String
msg=Open Table States Interactive
msg=msg & Set Next Document Parent & Frm.hWnd & Style 1
msg=msg & Map From States
mapinfo.do msg
-
MapInfo (, Ctrl+C
) . ,
, .
S
.
221
12:
(Callbacks)
MapInfo
, MapInfo
. , ,
, , MapInfo
, ID- .
(callback).
, MapInfo
:
. ,
, MapInfo
, x y.
. , ,
MapInfo (,
).
, MapInfo ,
.
.
(, ), MapInfo
. (
MapBasic WinChangedHandler.)
MapInfo. MapInfo
.
,
MapInfo, , MapInfo
.
,
, DDE- OLE.
Visual Basic 4.0 Professional Edition C++ .
Visual Basic 3.0 OLE,
DDE.
OLE
OLE:
1. Visual Basic 4.0, C++, , OLE-,
, OLE.
.
222
12:
2. MapInfo, ,
SetStatusText. , : .
3. , MapInfo
,
. :
.
4. , . , "CMyClass",
Visual Basic :
Public myObject As New CMyClass
5. , . , "CMyClass",
Visual Basic :
Public myObject As New CMyClass
6. , MapInfo, MapInfo
SetCallback :
mapinfo.SetCallback myObject
7. , MapInfo ,
,
Alter ButtonPad ... Add. (. 4).
, MapInfo ,
MapInfo. .
,
.
, MapInfo Run Menu,
.
8. , MapInfo ,
,
Alter Menu ... Add (. 4).
9. , MapInfo.
SetStatusText, MapInfo , .
MapInfo, ,
- .
WindowContentsChanged, MapInfo
(ID MapInfo), , .
, . ,
, MapInfo MapperInfo( ).
, MapInfo
, .
.
223
12:
, , ..
.
MapInfo
MapInfo. , MapInfo
OLE- , , . ,
, MapInfo, :
MI:-73.5548,42.122,F,F,-72.867702,43.025,202,
, MapBasic
CommandInfo( ). MBX-,
, MapBasic-. -
CommandInfo( ), . ,
, SHIFT
:
log_variable = CommandInfo(CMD_INFO_SHIFT)
CMD_INFO_SHIFT MAPBASIC.DEF.
.
1
2
3
4
5
6
7
8
CMD_INFO_X
CMD_INFO_Y
CMD_INFO_SHIFT
CMD_INFO_CTRL
CMD_INFO_X2
CMD_INFO_Y2
CMD_INFO_TOOLBTN
CMD_INFO_MENUITEM
CommandInfo ( )
MapBasic.
, OLE,
MapInfo ,
CommandInfo( ) . "MI:", OLE-
, MapInfo.
, MapInfo , :
MI: +
CommandInfo(1) + , + CommandInfo(2) + , +
CommandInfo(3) + , + CommandInfo(4) + , +
CommandInfo(5) + , + CommandInfo(6) + , +
224
12:
CommandInfo(7) + , + CommandInfo(8)
,
MapInfo. , , MapInfo
OLE- . 101,
:
MI:,,,,,,,101
, CommandInfo( )
.
, MapInfo,
. :
MI:-73.5548,42.122,F,F,-72.867702,43.025,202,
. x y
, ;
, SHIFT CTRL;
, ;
.
: ,
, .
, ,
.
.
C/C++
Visual Basic.
C.
MapInfo SetCallback, MapInfo
IDispatch.
MapInfo :
SCODE SetStatusText(LPCTSTR lpszMessage)
MapInfo SetStatusText ,
MapInfo. .
SCODE WindowContentsChanged(Unsigned Long windowID)
MapInfo WindowContentsChanged ,
.
. MapBasic WinChangedHandler.
225
12:
, MapInfo OLE,
. , ,
, OLE. ,
Visual Basic 3.0, OLE, Visual Basic 3.0
OLE.
MapInfo , OLE:
DDE, MapBasic ( MBX).
DDE
,
Calling. DDE,
DDE-. ,
, MapInfo DDE- DDE-,
. ,
(, " MI:,,,,,, 101 ").
FindZip. Form Load MapInfo
Alter ButtonPad ... Add
Calling DDE FindZip, MainForm
, , MapInfo DDE-
FindZip "MainForm" . ("MainForm"
LinkTopic). 11.
MBX
MapBasic ( MBX),
, MapBasic - MBX.
MapBasic-.
, Visual Basic MapInfo,
MBX, MapInfo :
mapinfo.do Run Application C:\MB\MYAPP.MBX
6.
MapInfo OLE- RunMenuCommand. , ,
MapInfo,
.
226
12:
MapInfo
MapInfo . .
F1 MapInfo, MapInfo
MAPINFOW.HLP.
: MapInfo
.
, MapInfo
MapInfo,
.
MapInfo
MapBasic:
Set Window Help Off
MapInfo . , MapBasic- MapInfo
CUSTOM.HLP MAPINFOW.HLP:
Set Window Help File CUSTOM.HLP Permanent
227
12:
4. ,
, ID-
ID- MapInfo.
, MapInfo ID- 2202. , 2202 ID- (Context ID) .
:
MapBasic
Windows (.HLP).
ID- MapInfo .
MapBasic
MapBasic,
. MapBasic .
Create Legend
;
.
Map
MenuitemInfoByHandler( ),
MenuitemInfoByID( )
228
MapInfo ( ).
Open Table
MapInfo.
RemoteQueryHandler( )
MapBasic-
DDE.
MapInfo
(ButtonPad).
SearchInfo( )
SearchPoint( )
SearchRect( ).
SearchPoint( ), SearchRect( )
(x,y)
.
12:
MapInfo
.
Set Application Window
MapInfo.
MapInfo
MapInfo.
Set Map
MapInfo-
(, ) ,
-.
Set Window
MapInfo.
SystemInfo( )
,
,
.
:
SYS_INFO_APPLICATIONWND,
HWND- .
WindowID( ), WindowInfo( )
MapInfo, .
OLE
MapInfo.
(Properties) .
229
12:
Application () MapInfo.
MBApplications (MapBasic-) MapBasic-, .
MBGlobals ( MapBasic) , MapBasic-.
Application
, Application.
, Visible
LastErrorCode.
230
12:
Name
(,
MapInfo). OLE.
Application.
FullName
. OLE.
Application
IDispatch Application.
OLE.
Parent
IDispatch
; Application
. OLE.
Version
, 100 (,
MapInfo 6.0.0 600).
ProductLevel
,
MapInfo. MapInfo
Professinal 400.
Visible
. ,
.
;
.
LastErrorCode
. ,
MapBasic, Do,
Eval RunCommand. ,
, 1000
MapBasic.
,
0.
LastErrorMessage
,
,
LastErrorCode.
Application
Do(string)
string
MapBasic, .
Eval(string)
string MapBasic-,
.
231
12:
, T F.
RunCommand(string)
string
MapBasic; Do.
RunMenuCommand
(menuid)
,
menuid Integer. .
DataObject(windowID)
ID- windowID
IUnknown,
.
QueryInterface
IDataObject. Idata
ObjectIUnknown .
:
,
C.
.
SetCallBack(IDispatch)
OLE (OLE Automation) ,
MapInfo.
.
:
,
C.
".
, VB- Do
MapInfo Map, :
mapinfo.Do Map From World
RunMenuCommand
MapInfo, 1702, MapInfo-
. (
MENU.DEF; 1702 M_TOOLS_RECENTER.)
mapinfo.RunMenuCommand 1702
MBApplications
MBApplications MapBasic-,
MapInfo . , ,
.
232
Item
IDispatch
programobject. VARIANT,
12:
(1..Count) ( ).
MBApplications.
Count
(..
).
Application
IDispatch MapInfo.
OLE.
Parent
IDispatch ;
MBApplications MapInfo.
OLE.
MBApplications
MBApplications MapBasic-.
, , .
Name
FullName
Application
Parent
(, FOO.MBX).
OLE MBApplication.
DOS- .MBX
MapBasic-.
OLE.
IDispatch MapBasic-.
OLE.
IDispatch ;
programobject MapInfo.
OLE.
, MapBasic-:
Dim appsList As Object
Dim firstname As String
Set appsList = mapinfo.MBApplications
If appsList.Count > 0 Then
firstname = appsList(1).Name
End If
MBApplications
Do(string)
string
RemoteMsgHandler MapBasic-.
Eval(string)
string
RemoteQueryHandler( ) MapBasic-;
. :
233
12:
Logical,
MapInfo , T
F.
MBGlobals
MBGlobals MapBasic,
MapBasic-. , , .
Item
IDispatch
mbglobal. VARIANT,
(1...Count)
( ).
MBGlobals.
Count
(.. ).
Application
IDispatch
MapInfo. OLE.
Parent
IDispatch
; MBGlobals
programobject. OLE.
MBGlobals
MBGlobals MapBasic.
, , , Value.
Value
.
,
;
.
MBGlobal.
234
Name
.
OLE.
Type
,
MapInfo (Integer, Date ..).
12:
Application
IDispatch MapBasic.
OLE.
Parent
IDispatch
; mbglobal
programobject,
.
OLE.
Visual Basic
(g_status) MapBasic-.
Dim globinfo As Object
Dim old_value As Integer
MapBasic-
Set globinfo = mapinfo.MBApplications(1).MBGlobals
old_value = globinfo(g_status).Value
:
globinfo(g_status) = old_value + 1
, globinfo(g_status) globinfo(g_status).Value.
235
12:
MIMapGen
, MIMapGen.
MIMapGen MapInfo ProServer;
, MapInfo Professional MIMapGen.
, MIMapGen,
ProServer.
Workspace
MapInfo.
MBApp
MapBasic
(MBX ). , MapInfo
MBX.
LongLat
:
. TRUE, ,
( CenterX
CenterY) .
FALSE,
.
SuppressDlgs
: TRUE,
.
,
Run Menu Command.
ImageWidth
, .
ImageHeight
CenterX
X- () .
CenterY
Y- () .
Zoom
( ).
,
MIMapGen. MIMapGen , ( ,
web ). MIMapGen,
, , MapInfo , .
.
236
12:
MIMapGen
MIMapGen.
ZoomCenterMap( )
,
CenterX, CenterY Zoom.
,
.
RenderMap( )
, ZoomCenterMap,
, .
ZoomMap(
double ZoomFactor)
,
.
;
.
ClickCenterMap(
long MouseX,
long MouseY)
,
. x/y
.
ClickCenterZoomMap(
long MouseX,
long MouseY,
double ZoomFactor)
,
.
ClearCosmeticLayer( )
, Map menu:
.
SQLUnselectAll( )
, :
.
SearchRadius(
double CenterPointX,
double CenterPointY,
double Radius)
SearchRadiusExt(
double CenterPointX,
double CenterPointY,
double OuterPointX,
double OuterPointY)
, ,
, .
SearchPoint(
double CenterPointX,
double CenterPointY)
SearchRect(
double x1,
double y1,
double x2,
double y2)
237
12:
GetTable(
string Tablename )
MISelection (IDispatch);
,
MISelection.
ExportMap(
string ImageType,
string FileSpec )
ExportMapEx(
string ImageType,
string FileSpec, string
Copy
rightInfo )
RefreshProperties()
ScreenToMap(
long ScreenX,
long ScreenY,
double MapX,
double MapY )
()
( / ).
MapGenHandler(
string Message )
RemoteMapGenHandler
MBX,
MBApp.
MapBasic MBX.
: .
, MISearchInfo.
MISearchInfo
MISearchInfo.
Rows
MIRows
( MIRow).
.
Fields
MIFields
( MIField).
( .)
.
TableName
: ,
.
: MISearchInfo,
MIMapGen: SearchRadius, SearchRadiusExt, SearchPoint SearchRect.
238
12:
MIRow
MIRow. MIRow
,
GetTable.
Value
,
arg.
VT_12, VT_14 VT_BSTR ( VT_BSTR
).
: MIRow, Rows
MISearchInfo MISelection.
MIField
MIField. MIField
,
GetTable.
Name
: .
Type
Short: .
: (1) DT_CHAR, (2) DT_DECIMAL, (3)
DT_INTEGER, (4) DT_SMALLINT, (5) DT_TIME,
(6) DT_LOGICAL, (8) DT_FLOAT.
Width
Short: ;
DT_CHAR DT_DECIMAL.
DecimalPlaces
Short:
DT_DECIMAL.
: MIField, Fields
MISearchInfo MISelection.
239
12:
MISelection
MISelection.
Rows
MIRows
( MIRow).
.
Fields
MIFields
( MIField).
(
.) ,
GetTable.
TableName
: ,
GetTable.
: MISelection, GetTable
MIMapGen.
MapInfo
MapInfo (DDE),
MapInfo (, Shell( ) Visual Basic)
DDE-. MapInfo 4.0 Windows
.
MapInfo ,
.
240
-nosplash
MapInfo
,
MapInfo, ..
-server
MapInfo
.
, ,
MapInfo
, DDE.
-automation -embedding
MapInfo
. ,
MapInfo
OLE (OLE Class Factory)
OLE, MapInfo
OLE-
.
12:
-regserver
MapInfo OLE
, .
MapInfo
. ,
MapInfo
.
,
MapInfo
OLE (OLE
Automation), OLE ..
-unregserver
MapInfo
,
.
.
,
-regserver.
-helpdiag
MapInfo,
MapInfo
F1.
.
: (/).
Visual C++ MFC
Visual C++
MFC, .
32 Visual C++ ( 2.0 ),
16 Visual C++ ( 1.52); ,
.
, ,
, .
1. Visual C++ 2.x (32) 1.5x (16).
241
12:
2. FILE > NEW (PROJECT >
APP WIZARD... 1.5).
3. MFC AppWizard.
(SDI), (MDI).
, OLE.
MapInfo,
OLE Automation 3 6 MFC AppWizard.
4. , , .
OLE Automation
OLE AppWizard,
OLE Automation .
1. STDAFX.H :
#include <afxole.h>
#include <afxdisp.h>
2. (.. .CPP)
CApp::InitInstance:
if (!AfxOleInit( )) {
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
3. ( .RC).
String Table, Resource > New String (
1.5 AppStudio). ID: IDP_OLE_INIT_FAILED
Caption: OLE.
OLE-. .
MapInfo
PROJECT > CLASSWIZARD (BROWSE > CLASSWIZARD 1.5)
OLE Automation Read Type Library.
MapInfo MAPINFOW.TLB. OK, ,
MapInfo OLE (OLE
Automation).
( .CPP)
.
#includes:
#include MapInfow.h
CApp theApp :
DMapInfo mapinfo;
242
12:
CApp::InitInstance, OnFileNew( ):
mapinfo.CreateDispatch(MapInfo.Application);
MAPINFOW.H :
extern DMapInfo mapinfo;
#include --\mapbasic.h
Visual C++ 1.5, OLE (link command line); Visual C++ 2.x
. Options > Project...
Linker.... Common to both Libraries: :
compobj, storage, ole2, ole2disp, ole2nls, mfcoleui
CApp::InitInstance,
CreateDispatch ( ):
::MessageBox(0, mapinfo.GetFullName( ), mapinfo.GetName( ), MB_OK);
.
MapInfo Professional DOS- MapInfo. ,
MapInfo OLE Automation.
::MessageBox... .
""
,
MapInfo. ; ,
.
, .
CApp::InitInstance
CreateDispatch :
//
mapinfo.Do(Set Window Help Off);
//
mapinfo.Do(Create Menu \MapperShortcut\ ID 17 as \(-\);
, ,
MapInfo.
MapInfo
MapInfo,
, , .
243
12:
,
,
MapInfo. , MapInfo
(, RunMenuCommand )
, MapInfo , .
MainFrm.CPP, CMainFrame::OnCreate :
#includes:
#include MapInfow.h
CMainFrame::OnCreate:
char str[256];
sprintf(str, Set Application Window %lu, (long)(UINT)m_hWnd);
mapinfo.Do(str);
, , :
mapinfo.Do(Note \ MapInfo\);
CApp::InitInstance OnFileNew( ).
, MapInfo
.
, MFC- , MapInfo
OLE Automation, ,
.
Project > ClassWizard ( Browse > ClassWizard 1.5).
(CView) Message Maps.
CView.
Messages WM_CREATE, Add Function;
WM_DESTROY, Add Function; WM_SIZE, Add
Function.
(VW.H) :
unsigned long m_windowid;
HWND
m_windowhwnd;
244
12:
(VW.CPP)
#includes:
#include MapInfow.h
(CView::CView)
:
m_windowid = 0;
m_windowhwnd = 0;
OnCreate CView::OnCreate:
// ClipChildren
SetWindowLong(m_hWnd, GWL_STYLE,
GetWindowLong(m_hWnd, GWL_STYLE)
|WS_CLIPCHILDREN);
char str[256];
mapinfo.Do(Open Table \States\ Interactive);
sprintf(str,
Set Next Document Parent %lu Style 1 Map From States,
(long)(UINT)m_hWnd);
mapinfo.Do(str);
m_windowid = atol(mapinfo.Eval(WindowID(0)));
sprintf(str, WindowInfo(0, %u), WIN_INFO_WND);
m_windowhwnd = (HWND)atol(mapinfo.Eval(str));
OnDestroy CView::OnDestroy:
if (m_windowhwnd) {
::DestroyWindow(m_windowhwnd);
m_windowhwnd = NULL;
m_windowid = 0L;
}
OnSize CView::OnSize:
if (m_windowhwnd && cx > 0 && cy > 0) {
::MoveWindow(m_windowhwnd, 0, 0, cx, cy, TRUE);
}
.
, > .
1. (.RC), Menu
IDR_MAINFRAME. ( Visual C++ 1.5 AppStudio.)
2. RC-.
245
12:
3. Project > ClassWizard (Browse > ClassWizard... 1.5)
Message Map CView Class Name. Object
ID ID-
ID_MAP_LAYERCONTROL. ,
COMMAND UPDATE_COMMAND_UI Messages.
, Add Function
.
4. CView , .
.
void CView::OnMapLayercontrol( )
{
mapinfo.RunMenuCommand(M_MAP_LAYER_CONTROL);
}
void CView::OnUpdateMapLayercontrol(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_windowid);
}
-
. , MapInfo: ,
. ( Tools);
,
ClassWizard.
1. , ,
(, ,
).
UPDATE_COMMAND_UI COMMAND, MAPBASIC.H
(M_TOOLS_SELECTOR, M_TOOLS_RECENTER, M_TOOLS_EXPAND,
M_TOOLS_SHRINK); .
.
2. RC- , IDR_MAINFRAME
64 ( 4 16).
.
3. .
, ID- -
; , MAPINFOW.MNU, ,
ID_TOOLS_SELECTOR \n.
4. MAINFRM.CPP UINT BASED_CODE buttons[ ] static
ID- ,
.
5. , ,
. CView
, :
246
12:
int
m_eMouseMode;
6. ,
.
MapInfo .
m_eMouseMode = M_TOOLS_SELECTOR;
7. ,
COMMAND UPDATE_COMMAND_UI; , ,
.
8. , CCmdUI::SetRadio OnUpdate m_eMouseMode
OnTools. :
void CView::OnToolsSelector( )
{
m_eMouseMode = M_TOOLS_SELECTOR;
mapinfo.RunMenuCommand(M_TOOLS_SELECTOR);
}
void CView::OnToolsGrabber( )
{
m_eMouseMode = M_TOOLS_RECENTER;
mapinfo.RunMenuCommand(M_TOOLS_RECENTER);
}
void CView::OnToolsZoomin( )
{
m_eMouseMode = M_TOOLS_EXPAND;
mapinfo.RunMenuCommand(M_TOOLS_EXPAND);
}
void CView::OnToolsZoomout( )
{
m_eMouseMode = M_TOOLS_SHRINK;
mapinfo.RunMenuCommand(M_TOOLS_SHRINK);
}
void CView::OnUpdateToolsSelector(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio(m_eMouseMode == M_TOOLS_SELECTOR);
pCmdUI->Enable(m_windowid);
}
void CView::OnUpdateToolsGrabber(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio(m_eMouseMode == M_TOOLS_RECENTER);
pCmdUI->Enable(m_windowid);
}
void CView::OnUpdateToolsZoomin(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio(m_eMouseMode == M_TOOLS_EXPAND);
pCmdUI->Enable(m_windowid);
}
247
12:
void CView::OnUpdateToolsZoomout(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio(m_eMouseMode == M_TOOLS_SHRINK);
pCmdUI->Enable(m_windowid);
}
MapInfo
MapInfo ,
, MFC- COleDispatchException. MapInfo
m_wCode COleDispatchException
m_strDescription COleDispatchException. OLE
COleException.
, MFC-
, Command failed.
DMapInfo.
, DMapInfo::Do.
DMapInfo::Do, ClassWizard, :
void DMapInfo::Do(LPCTSTR command)
{
static BYTE BASED_CODE parms[] = VTS_BSTR;
InvokeHelper(0x6001000b, DISPATCH_METHOD, VT_EMPTY,
NULL, parms, command);
}
DMapInfo::Do,
, :
void DMapInfo::Do(LPCTSTR command)
{
static BYTE BASED_CODE parms[] = VTS_BSTR;
try {
InvokeHelper(0x6001000b, DISPATCH_METHOD, VT_EMPTY,
NULL, parms, command);
}
catch(COleDispatchException *e) {
// .
// e->m_wCode.
AfxMessageBox(e->m_strDescription);
e->Delete( );
}
catch(COleException *e) {
AfxMessageBox(Fatal OLE Exception!);
e->Delete( );
}
}
248
12:
OLE Automation
CDoc.cpp (Dispatch map)
(Message map):
BEGIN_DISPATCH_MAP(CDoc, CDocument)
//{{AFX_DISPATCH_MAP(CDoc)
//: ClassWizard
//
//
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP( )
CDoc.cpp CDoc:
EnableAutomation( );
AfxOleLockApp( );
CDoc.cpp CDoc:
AfxOleUnlockApp( );
CDoc.h "Dispatch" :
// OLE-
//{{AFX_DISPATCH(CDoc)
//: ClassWizard
//
//
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP( )
: ,
OLE- CDocument-. MFC,
OLE-
, CCmdTarget. MDI-
OLE- CWinApp,
CMDIFrameWnd;
CCmdTarget. , IDispatch
MapInfo . MDI-
249
12:
. IDispatch ,
.
(callback) WindowContentsChanged
(SDI)
CDoc ,
CDoc ,
.
mapinfo.SetCallback(this->GetIDispatch(FALSE));
, , MapBasic.
250
:
MapBasic :
: ,
MapInfo .
() \MAPBASIC
ANIMATOR:
.
APPINFO:
MapBasic.
AUTOLBL: ,
(, MapInfo).
COGOLINE: .
DMSCNVRT: --
.
GEOREG: GeoTIFF, ,
MapInfo GeoTIFF.
GRIDMAKR: .
ICONDEMO: MapInfo 4.0,
.
LEGENDS: . (
MapInfo .)
ROTATE: , .
R_BUFER: .
SEAMMGR: .
SHIELDS: ,
.
SRCHREPL: .
SYMBOL: , MapInfo 3.0
.
() SAMPLES\VB
FINDZIP: MapInfo,
, , VisualBasic.
VMAPTOOL: MapInfo,
(callbacks). VisualBasic 4.0
Professional Edition.
:
() SAMPLES\MFC
FINDZIP: MapInfo
, C++ MFC.
() SAMPLES\PWRBLDR
CAPITALS: MapInfo
, Power Builder. Runtime- Power
Builder ,
, Power Builder .
() SAMPLES\DELPHI
TABEDMAP: MapInfo
, Delphi.
() SAMPLES\MAPBASIC\SNIPPETS
,
MapInfo.
ACAD: AutoCAD Windows DDE.
ADDNODES: .
;
,
.
GEOCODE: MapBasic.
GEOSCAN: .
GET_TAB: , . GET_TAB
. GET_TAB
OVERVIEW.
LONGLATS: , --
. , ,
LLPROJ.MBP.
NVIEWS: ,
( ).
" ". , ,
NVPROJ.MBP.
OBJINFO: .
OVERVIEW: , ,
; , ,
.
. ,
, OVPROJ.MBP.
SCALEBAR: . ,
, SBPROJ.MBP.
252
:
TEXTBOX: , .
2. , ,
TBPROJ.MBP.
WATCHER: DDE Microsoft Excel; Excel
MapBasic-.
() SAMPLES\MAPBASIC\LIB
AUTO_LIB: , .
MapBasic,
MapInfo.
STARTUP.
AUTO_LIB TEXTBOX; "
""" , .
MISTLIB: .
STR_LIB: .
() SAMPLES\MAPBASIC\DATABASE
.
.
253
B: TEXTBOX
TEXTBOX
. .
'********************************************************************
'
MapBasic: TEXTBOX.MB
'
'
'
'
:
'
'
'
'
'
'
'
(2)
(3)
(1)
,
,
, , .
OK
.
' :
'
, .
'
.
'
'
' MapBasic:
'
'
Dialog
'
SelectionInfo()
'
ObjectGeography()
'
ObjectInfo()
'
Alter Object
'
Update
'
ProgressBar
'
OnError
'
'
AUTO_LIB
MapInfo.
'
B: TEXTBOX
'*********************************************************************
'
sub-
Include-
'
Include "mapbasic.def" '
Include "auto_lib.def" ' AUTO_LIB,
' AUTO_LIB.MB
'*********************************************************************
'
Global
Global
Global
Global
Global
Global
Global
Global
Global
on_layout As Logical
table_name As String
pstyle As Pen
bstyle As Brush
box_type, num_rows, next_row, num_drawn As Integer
reset_color As Logical
'TRUE=
line_color As Integer
'RGB-
shift_ok As SmallInt
' "OK"
shift_cancel As SmallInt ' ""
'*********************************************************************
' : Main
'
' Main ,
'
'
'*********************************************************************
Sub Main
' ,
gsAppFilename = "textbox.mbx" '
gsAppDescription = """""" ' MB-
If SystemInfo(SYS_INFO_PLATFORM) = PLATFORM_MAC Then
shift_ok = 45
' Macintosh
' -
shift_cancel = 0
Else
shift_ok = 0
shift_cancel = 45 ' Windows
'"" "OK"
256
B: TEXTBOX
End If
Create Menu "" As
"& ..." Calling create_sub,
"&" Calling Bye,
"& """"..."
Calling About
Alter Menu "" Add
"(-",
"" As ""
Alter Menu Bar Remove ID 6, ID 7
Alter Menu Bar Add "", ID 6, ID 7
Menu Bar Show
'
pstyle = MakePen(1, 2, BLACK) '
bstyle = MakeBrush(1, 0, 0)
'
box_type = 1
' -
reset_color = FALSE ' -
End Sub
'*********************************************************************
' Sub-: About
'
' > ""
' .
'*********************************************************************
Sub About
Dialog
Title " """""
Control StaticText
Title " "
Position 10, 10
Control StaticText
Title " ."
Position 10, 18
Control StaticText
Title " "
Position 10, 40
Control StaticText
Title " , "
Position 10, 48
Control StaticText
Title """ "" """"."
Position 10, 56
Control StaticText
Title ": """" "
Position 10, 80
Control StaticText
Title " ()."
Position 10, 88
Control Button
Title "..."
Calling HandleInstallation
Width 80
257
B: TEXTBOX
Position 30, 110
Control OKButton
Title "OK"
Position 130, 110
'
'
'
'
: """"
HandleInstallation() AUTO_LIB.
, ,
"" MapInfo.
End Sub
'*********************************************************************
' Sub- create_sub
'
' > > .
' ,
' .
'*********************************************************************
Sub create_sub
'
Dim i As SmallInt, text_objs As Logical
Dim destination_table As String
' ,
' , .
num_rows = SelectionInfo(SEL_INFO_NROWS)
If num_rows > 0 Then
table_name = SelectionInfo(SEL_INFO_TABLENAME)
If TableInfo(table_name, TAB_INFO_MAPPABLE) = FALSE Then
Note " " + Chr$(13)
+ " ."
Exit Sub
End If
Else
'( )
Note " "
+ Chr$(13) + " ."
Exit Sub
End If
' ,
' ( ).
' , .
'
' ,
' . 20 ,
' , .
258
B: TEXTBOX
i = 1
text_objs = FALSE
Do While i <= num_rows
Fetch Rec i From Selection
If Str$(Selection.obj) = "Text" Or i > 20 Then
text_objs = TRUE
Exit Do
End If
i = i + 1
Loop
If Not text_objs Then
Note " "
+ Chr$(13) + " ."
Exit Sub
End If
' , :
' .
on_layout = FALSE
If TableInfo(table_name, TAB_INFO_TEMP) = TRUE And
Left$(table_name, 6) = "Layout" Then
on_layout = TRUE
Else
' , ,
' "--". , .
If TableInfo(table_name, TAB_INFO_READONLY) Then
Note " ," + Chr$(13) +
" ." + Chr$(13) + Chr$(13) +
" " + table_name + " "
+ " ."
Exit Sub
End If
End If
If on_layout Then
destination_table = " "
ElseIf InStr(1, table_name, "Cosmetic") > 0 Then
destination_table = " "
Else
destination_table = " " + table_name
End If
Dialog
Title " "
Control StaticText
Title " "
Position 15, 5
Control GroupBox
Title " :"
Position 10,20
Width 160
Height 40
Control RadioGroup
Title "&;& "
Position 20,32
Value box_type
Into box_type
Control StaticText
259
B: TEXTBOX
Title " :"
Position 20,70
Control PenPicker
Value pstyle
Into pstyle
Position 70,70
Width 20
Height 20
Control GroupBox
Title " :"
Position 10,100
Width 160
Height 40
Control StaticText
Title destination_table
Position 20,120
Control CheckBox
Title " "
Position 10, 150
Value reset_color
Into reset_color
Control OKButton
Title "OK"
Position 90 + shift_ok, 180
Control CancelButton
Title ""
Position 90 + shift_cancel, 180
' . "" .
If Not CommandInfo(CMD_INFO_DLG_OK) Then
Exit Sub
End If
line_color = StyleAttr(pstyle, PEN_COLOR)
num_drawn = 0
'
next_row = 1
'
'
' Set CoordSys
If on_layout Then
Set CoordSys Layout Units "mm"
Else
Set CoordSys Earth
End If
' ( "").
' ProgressBar NEXTBOX,
'
"".
ProgressBar " ..."
Calling next_box Range num_rows
If CommandInfo(CMD_INFO_DLG_OK) Then
Note " . " + Chr$(13) + Chr$(13) +
" : " + Str$(num_drawn)
Else
Note " ! " + Chr$(13) + Chr$(13) +
" : " + Str$(num_drawn)
End If
Exit Sub
End Sub
260
B: TEXTBOX
Brush bstyle
Else
'
radius = .6 * Minimum(dx, dy)
Create RoundRect
Into Variable tbox
261
B: TEXTBOX
(x1, y1) (x2, y2) radius
Pen pstyle
Brush bstyle
End If
Insert Into table_name (obj) Values (tbox)
num_drawn = num_drawn + 1
If
reset_color
Then
' ...,
' " ",
' :
' ,...
'
oldfont = ObjectInfo(objcopy, OBJ_INFO_TEXTFONT)
'
' ,...
newfont = MakeFont( StyleAttr(oldfont, FONT_NAME),
StyleAttr(oldfont, FONT_STYLE),
Maximum(StyleAttr(oldfont, FONT_POINTSIZE), 1),
line_color,
StyleAttr(oldfont, FONT_BACKCOLOR)
'
' Object...
'
'
' ,
'
Update Selection Set Obj= objcopy Where RowID=next_row
End IF
End If
If next_row >= num_rows Then
ProgressBar = -1
'
':
Else
ProgressBar = next_row
':
End If
next_row = next_row + 1
End Sub
'**************************************************************************
' Sub procedure: Bye
'
' > .
'
' .
'**************************************************************************
Sub Bye
262
B: TEXTBOX
End Program
End Sub
'///////////
TEXTBOX.MB
////////////
263
C: MapBasic 6.0
, MapBasic
6.0. .
MapBasic .
MapBasic 6.0
:
3D
Create Map3D
Set Map3D
Map3DInfo()
Objects Check
Objects Enclose
ConvexHull( )
/
HotLinks
Query HotLink LayerInfo( )
Open Table HotLinks
Set Map HotLinks
CommandInfo( ) HotLinks
MS Access
Open Table
MS Access
Type Commit Table MS Acess
C: MapBasic 6.0
Type Create Table MS Acess
Align Set Cartographic Legend
Set Map Clip Region
Clip Region MapperInfo( )
Create Object
Inset/Offset Clause Find Using
Run Menu Command
Printing/Export Paper Size Margin Enhancements
Set Window
Papersize, Margin Attributes Advanced Options WindowInfo( )
272
D: ODBC
MapInfo ODBC:
SQL_BIT
SQL_TINYINT
SQL_SMALLINT
SQL_INTEGER:
SQL_REAL
SQL_BIGINT
SQL_DECIMAL
SQL_DOUBLE
SQL_FLOAT
SQL_NUMERIC
SQL_BINARY
SQL_LONGVARBINARY
SQL_VARBINARY
SQL_LONGVARCHAR
SQL_DATE
SQL_TYPE_DATE
SQL_TIMESTAMP
SQL_TYPE_TIMESTAMP
SQL_TIME
SQL_TYPE_TIME
SQL_CHAR
SQL_VARCHAR
E:
.
.
:
.
MIUPLOAD.MBX, .
.
MIUPLOAD.MBX .
MapInfo,
.
, .
-, ,
. ,
.
-, MapInfo ,
, , MapInfo
Map Catalog. .
MIODBCAT.MBX Oracle7, Sybase, SQL Server, SQL Base
MSAccess.
. , ,
. ,
, MapInfo.
-, MapInfo ,
MapBasic Server Create Map.
MapInfo.
E:
MapInfo
ODBC- , MapInfo Map Catalog
, . MapInfo Map Catalog
.
1. MAPINFO PASSWORD *****
, .
2. MAPINFO_MAPCATALOG .
Create table MapBasic:
Create Table MAPINFO_MAPCATALOG
(SPATIALTYPE
Float,
TABLENAME
Char(32),
OWNERNAME
Char(32),
SPATIALCOLUMN
Char(32),
DB_X_LL
Float,
DB_Y_LL
Float,
DB_X_UR
Float,
DB_Y_UR
Float,
COORDINATESYSTEM Char(254),
SYMBOL
Char(254),
XCOLUMNNAME
Char(32),
YCOLUMNNAME
Char(32)
)
, , .
, , varchar
. Char datatype.
3. TABLENAME OWNERNAME;
.
4. , Select, Update Insert
MAPINFO_MAPCATALOG.
.
276
' ()................................................................30
- () ............................................................41
""
..................................................... 79
& ()....................................................79; 92
( )......................................................41
* () ...........................................................41
/ ()..................................................................41
^ ( ) ........................................41
+ ()..............................................................41
<< ()...............................................................42
<<= ( )........................................42
<<> ()...................................................42
= ( ) ................................................159
= () ............................................................42
> () ..................................................................42
>= ( )...........................................42
16-bit, 32-bit
DLL ............................................. 194
Chr$( ) .....................................................187
Close Window () .............................94; 206
CommandInfo( ) ()
DDE ...................................................... 204
........................ 102
........... 90
OK .......... 85
................ 121
Commit ()................................................122
Commit ()..................................................98
Commit Table ()......................................95
DLLs
16 vs. 32 bit............................................. 194
Do Case () ..................................................47
Do...Loop () ...............................................49
Drop Map () ........................................... 157
End Program ()........................................49
EndHandler ()........................................54
EOF( ) () ................................................... 150
EOT( ) () ................................................... 117
Err( ) ()........................................................66
Error$( ) ().................................................66
ERRORS.DOC......................................................... 219
Fetch ()...........................................117; 167
FileExists( ) ()......................................... 149
FileOpenDlg( ) ().......................................82
FileSaveAsDlg( ) () ..................................83
Font ()............................................................. 159
For...Next ()..............................................48
Format$( ) () .............................................97
FrontWindow( ) ()....................................94
Function...End Function ()....................58
Get () ........................................................151
GetMetaData$( ) ()................................138
GetSeamlessSheet( ) ()..........................141
GIF-...............................................................135
GoTo ().......................................................47
Grid Thematic support ...........................................95
Help-, Windows ..........................206
Include ()...................................................59
Input # ().................................................149
Insert ()................................... 98; 122; 165
Inserting
...................................... 122
IntersectNodes( ) ()................................169
Intersects ( )............177
Intersects () ..............................................44
JPG-..............................................................135
Kernel (Windows DLL) .........................................193
Kill ()........................................................149
Like ().........................................................42
Line Input # ()........................................149
Live remote database access...............................144
Main ().....................................................51
MAPINFOW.MNU ().....................................79
MapMarker () ...............................................121
MFC
.................................. 250
................................................ 241
Microsoft Excel
DDE -............................................. 200
...................................... 115
Print # () .................................................150
Print ().......................................................98
ProgressBar () .........................................84
PushButtons ( )...........................101
278
Visual C++
sample programs....................................... 250
................................................. 241
While...Wend ()........................................49
WIN.INI
DDE ............................... 201
.............................................. 193
WinChangedHandler () ......................54
WinClosedHandler () ..........................54
Window identifiers ..................................................94
WindowID( ) ()..........................................94
WindowInfo( ) ()..............................94; 129
WinFocusChangedHandler () ...........54
Within ( ).................177
Within ()....................................................44
Write # ()................................................150
, .........................................................121
.................................... 52
...................................... 52
...............................41
, ............57
() ..............................135
, .....................................................166
, .................................................251
................................................ 77
.................................................. 78
/ ............ . /
/
i/o ................................ 151
................................. 149
..................................... 152
............................................. 147
............................. 149
............................... 151
....................................... 149
/
................................................................................149
..................................................... .
...................... 23
Windows DLL.......................................... 190
DBF (dBASE) .......................................... 115
WKS (Lotus) ........................................... 115
XLS (Excel)............................................. 115
.................................. 124
........................................ 164
.................................. 106
MapBasic..........81
............................23; 191
.......................................................51
................................................... 64
........................................................ 160
.....................................75
................ .
.............................. 176
.................................44
.................................................... 252
MapMarker.............................................. 121
....................................... 121
........................................ 121
.......................................35
........................................................ 205
() ...........................................................97
...................... .
............................................... 34
..............................................42
-......................................................39
.................................................. 151
(/) ...................... 148
........................... 103
............. 90
............................................ 142
............................................ 142
.......................................................... 192
.................................... 109
()
...................................................................................84
......................................... 87
................................................. 185
,
...................... 89
................................................. 93
............................ 92
............................... 91
................................ 85
.................................................. 85
..................................... 85
.............. 90
, .................... 92
............................... 89
, . ,
.................................................. 86
, ........................93
,
OK/ .................... 82
....................................... 82
.................................... 82
................................. 84
................. 111
279
...................................... 83
,
, .................. 92
......................................59
........................................................177
........................124
..............................164
.....................142
............................142
............................................................152
.............................................. 175
................................................ 175
............................................. 175
........................................... 222
, ......................................... 85
, ................................ 81
...................................................... 73
...................................................... 70
....................................................... 94
...............13
()..............................................................95
............................................................. 173
-..................................... 221
............................................... 92
.................................................... 79
................................49; 50
...........................................16
/
...................................... 142
DDE.......................................... 200
....................................................... .
....................................82
.................................................19
............................... 107
MapInfo ............................................. 7; 8
MapBasic ..................................... 27
......................... 109
-)......................................... 101
-...................................... 101
................................................ 158
................................. 158
................................. 158
........................... 162
, .........................59
.........144
.............................................168
() .................................135
SPOT............................135
................................ 3
........................................ 149; 188
, ........................................ 123; 124
, ....................111
....................................... 3
ICONDEMO.MBX ..................................... 105
.................................. 103
(PushButtons) .................. 101
- (ToolButtons)............ 101
- (ToggleButtons) ...... 101
................................ 198
.............................. 107
........................... 102
..................................... 219
MFC ...................................................... 241
............................ 216
....................... 217
................... 216
.................................................. 213
................................................ 250
....................................... 240
280
......................... 126
.................................94
.................................. 25
................................. 20
....................................... 18
......................................7; 8
....................................................... 39
............................................... 39
............................................. 37
................................................. 39
.............................................38; 39
MapInfo DDE........................ 205
........................65
............................................ 251
............................................. 173
..................................................... 173
.................................................... 173
.................13
.............................................128
......................................... 97
................................... 95
( )...............................117
...................................................................108
..................................................... .
.................................................. .
......................................................81
..........................................39
.........................................43
........................................32
........................................24
.............................................. 34
............................. 184
..................................................... 34
................................................................27
................................................ 77
.................................................. 78
..............................................................25
...........................................................25
............................................................27
..........................................................28
................................................................24
,
.............................. 76
............................ 79
MAPINFOW.MNU.............................. 79
,
........................ 73
........................... 75
............................................... 74
........................... 74
............................................................137
................................................... 137
................................................47
...................173
.........................130
....................................................187
.................................................152
....................................................25
............................................180
...................152
............................................ 142
............................................ 142
.................................26
.................................................. .
............................................. 180
...............................58
...................................................................................66
. ,
................................................. 166
............................................ 179
OLE ................................................. 229
................................................ 158
............................................ 158
..................................................... 159
....................................... 164
,
..................................... 164
....................................... 169
............................................ 166
............................................. 168
............................... 165
..................................................... 168
........................................ 168
........................................... 168
,
..................................................... 166
,
......................... 166
.............................................. 163
............................... 165
................................................ 164
, ................................................. 157
................................................. .
,
................................................... 98
................................................... 97
..................................... 98
...................................................... 98
............................................ 111
.................................. 94
......................................... 96
......................................... 95
.............................................. 98
.................................................... 97
,
...................................................... 95
MapBasic..........................................................31
................................................ 98
.................................... 99
................................................. 169
,.......................................... 251
..............................................................97
......................................... .
Select............................................176; 177
Set Table .............................................. 141
281
...................................44; 176
............................................... 43
........................................... 42
.............................................. 37
................................... 44
................................................. 42
.................................................. 41
................................................. 41
................................. 145
........................... 111
- ............................. 56
.....................................61
..........................................49
............................23
...............................................114
.................................................64
............................... 173
.................................... 129
.......................................... 98
................................................. 98
............................................. 18
................................................ 66
.................................64; 122
....................................................186
.................................... 52
...................................... 52
.............................................. 32
.............................................. 32
.............................................. 35
.................................. 36
.............................................. 156
.............................. 184
................................ 32
............................................ 33
.................................... 160
Alias.......................................118
.......................................168
................................................... 169
................................................ 166
Intersects..................................... 44
..................................................... 121
........................................................251
...................................................................197
282
................................................................ 103
......................................................95
...................... 251
-............................. 56
............................................................... 178
............................................... 169
................................................. 164
............................. .
........................................................25
................................... 251
.................................................... 121
........................................26
........................................... .
- ................ 188
.................................................... 151
.......................44
......................................44
................................ 149
(/)..... 148
..................... 251
..........................................41
............................................. 186
........................................... 186
.................. 250
...................32
.................................... 251
...................................................................95
......................................... 151
(/) ............. 148
.............................30
........ 180
Main ....................................................... 51
...................................................... 51
.................................... 53
............................................. 51
.................................. 52
................................................. 53
.............................................. 109
...... 12
........................................................ 160
..............................................95
()............................................98
.................................................... 157
............... 135
.............................................. 103
........................... 111
- ............................. 56
................................. 145
.....................................................................53
....................... 157; 179
................................... 25
................................. 20
................................. 22
.............................................144
...............................................C.
.....................142
..................81
.......................... 129
.............................C.
..............................................173
,
................................. 145
,
................................. 145
,
........................... 111
....................................................240
................................................ 166
.................................................166
/ ................................. 95
................................. 128
................................... 95
................................. 73
,
.................................. 106
............................. 71
.............................................. 54
............................. 54
OS/2.........................................205
................................................221
................................................................. 5
............. 101
........................................................ 98
.............................122
........144
,
Windows ...................................... 206
().........................................42
..................................................159
...............................42
................................ 109
(Pen, Brush, Symbol, Font) .................... 159
(Pen).................................................... 159
(Symbol) .................................. 159
(Font) ........................................... 159
............................................160; 186
(Brush).......................................... 159
..................................... 168
......................................... 97
................................... 95
................ 222
......................................... 122
(RowID) ......................................... 120
............................................. 122
................ 98
............................................. 122
......................... 117
....................................33
............................33
..............................................39
.............................................41
........... 33
..................................................................34
.................................................. 140
Selection................................................. 126
................. 124
............. 124
........................ 124
QueryN........................... 126
...................................... 122
.................... 125
Obj (object) ................................. 120
................................. 128
............................................ 137
115
........................................... 120
............................................ 179
................................................ 114
................................................... 129
.......... 123
............................ 135
....................................... 130
................................................. 123
............................................... 125
, ............................... 124
283
- ................................. 134
...................................... 117
QueryN
............................................... 126
................................................. 124
................................ 124
.................................................. 76; 79
.................................................... 149
......................................... 168
................................... 74; 79
............................. 169
......................................................95
WIN.INI ..........................................193
MAPINFOW.MNU.......................................79
.............................................. 20
.................................................. 21
..................................................... 22
.................................................. 21
DBF(dBASE).............................................115
Excel ...........................................................115
FoxBase......................................................115
Lotus...........................................................115
WKS, ......................................115
XLS, ........................................115
, ........................13
, ........115
,
BIL (SPOT)...... ...................................135
GIF ........................................... 135
JPG .......................................... 135
284
, ................58
CommandInfo( )
.................... 78
, ...................................................... 161
..................................41
Do Case.................................................... 47
Do...Loop................................................. 49
For...Next................................................ 48
While...Wend ........................................... 49
........................................ 164
.............................................38
.................................. 39
.............................................41
...........................42
ListBox......................................92
MultiListBox............................92
PopupMenu ..............................92
CheckBox................................................. 88
EditText .................................................. 87
GroupBox ................................................ 87
ListBox ................................................... 88
MultiListBox............................................ 88
PopupMenu .............................................. 88
RadioGroup.............................................. 87
StaticText................................................ 87
BrushPicker................................... 88
CancelButton ................................. 89
FontPicker .................................... 88
OKButton ..................................... 89
PenPicker...................................... 88
SymbolPicker................................. 88
................................................... 89
........................................87