To get what you want, define your own ToolButton (see the online help on
Create Buttonpad and Alter Buttonpad) that uses DrawMode DM_CUSTOM_POLYGON.
________________________________
Spencer
--
You received this message because you are subscribed to the Google Groups
"MapInfo-L" group.
To post to this group, send email to mapi...@googlegroups.com.
To unsubscribe from this group, send email to
mapinfo-l+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mapinfo-l?hl=en.
Have a look at the Alter ButtonPad statement in the Reference Guide. You need to create a toolbutton using DM_CUSTOM_POLYGON, which allows the user to draw a polygon. When the user has finshed, you retrieve the object created by the user using CommandInfo(CMD_INFO_CUSTOM_OBJ) and at this point you can display the dialog.
Something like this should work (not tried it but hacked from some code that does work...):
'//Incudes
Include "c:\program files\mapinfo\mapbasic\mapbasic.def"
Include "c:\program files\mapinfo\mapbasic\icons.def"
'//Declarations
Declare Sub Main
Declare Sub Main_Loop
'// Main subroutine
Sub Main
Alter ButtonPad "Tools"
Add ToolButton
HelpMsg "Draw a custom polygon \nCustom Polygon"
Icon 180
Cursor 138
DrawMode DM_CUSTOM_POLYGON
Calling Main_Loop
Show
End Sub
Sub Main_Loop
Dim objTmp As Object
Dim iWinID As Integer
'// check to see if window is a mapper
If WindowInfo(FrontWindow(), WIN_INFO_TYPE) <> WIN_MAPPER Then
Note "This tool only works in a map window!"
Exit Sub
Else
iWinID = WindowInfo(frontwindow(), WIN_INFO_WINDOWID)
End If
'// get the object created by the user
objTmp = CommandInfo(CMD_INFO_CUSTOM_OBJ)
'// now you can display a dialog box here....
End Sub
Greg Driver
NOT PROTECTIVELY MARKED
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On Behalf Of 888Peter777
Sent: 09 March 2010 13:13
To: MapInfo-L
Subject: [MI-L] Code behind draw polygon tool
--
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To post to this group, send email to mapi...@googlegroups.com.
To unsubscribe from this group, send email to mapinfo-l+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mapinfo-l?hl=en.
Information about this E-mail
This email and any files or attachments with it are intended solely for the use of the individual(s) or organisation(s) to whom it is addressed.
It may contain information that is confidential or subject to legal and/or professional privilege.
If you have received this email in error please notify the sender and delete it including any files or attachments from your e-mail account or computer.
Any opinions expressed in this email are those of the individual and not necessarily those of Surrey Police.
Surrey Police monitor incoming and outgoing e-mail.