stella
I have attached code that does the job and i will email directly an
executable for you (I am loathe to put this tool on the directionsmag site
because its so...well small... if anyone else wants it.. email me direct NOT
THE LIST and put the word MAPXY in the subject)
regards
r
note the code uses the mapbasic tool handler and adds a menu option to clear
the xy text each time you click...
no frills..!..
code follows>>>>>>>>>>>>>>>>>
include "mapbasic.def"
declare sub main
Declare Sub ToolHandler
declare sub mycheck
dim clearmylbl as logical
sub main()
Create Menu "&Qik_XY_click" As
"!Clear old click" id 887 Calling mycheck
Alter Menu ID 4 Add "Qik_XY_click" as "Qik_XY_click"
end sub
sub mycheck
if clearmylbl then 'checked so uncheck it
clearmylbl = false
Alter Menu Item id 887 uncheck
else 'not checked so check it
clearmylbl = True
Alter Menu Item id 887 check
end if
end sub
Sub ToolHandler
dim win_id as integer
dim lablstr as string
dim kosmetiq as string
dim txtobj as object
dim minx, maxx, miny, maxy, scaledistx, scaledisty as float
win_id = FrontWindow()
onerror goto notopen
If WindowInfo(win_id, WIN_INFO_TYPE) <> WIN_MAPPER Then
Note "This tool may only be used on a Map window."
Exit Sub
End If
set coordsys window win_id
minx = mapperinfo(win_id, mapper_info_minx)
maxx = mapperinfo(win_id, mapper_info_maxx)
scaledistx = (maxx - minx)/10
miny = mapperinfo(win_id, mapper_info_miny)
maxy = mapperinfo(win_id, mapper_info_maxy)
scaledisty = (maxy - miny)/20
kosmetiq = windowinfo(win_id, win_info_table)
if clearmylbl then
delete object from kosmetiq
end if
lablstr = (Round(CommandInfo(CMD_INFO_X), 0.1) + Chr$(10) +
Round(CommandInfo(CMD_INFO_Y), 0.1))
create text into variable txtobj
lablstr
(CommandInfo(CMD_INFO_X), CommandInfo(CMD_INFO_Y)) (CommandInfo(CMD_INFO_X)
+ scaledistx, CommandInfo(CMD_INFO_Y) + scaledisty)
insert into kosmetiq(obj) values(txtobj)
exit sub
notopen:
note error$() & "you need an open mapper window for this tool to function"
End Sub
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 02 April 2004 02:33
To: Ian Erickson
Cc: [EMAIL PROTECTED]
Subject: Re: MI-L Returning XY Coordinates
No-one has suggested a tool that does this, though I have found out the
string command to return the centroids as a label (thanks Jaromir :).
I am mainly using version 7.5 MapInfo and I do not have a copy of MapBasic
(though I would probably get lost trying to program anything anyway)
If I cannot get a tool then I will do it manually, I was just hoping for a
shortcut.
Thanks
Stella
"Ian Erickson" <[EMAIL PROTECTED]> on 02/04/2004 03:20:48 AM
To: <[EMAIL PROTECTED]>
cc:
Subject: Re: MI-L Returning XY Coordinates
Did you ever find a tool that could do this? And what version of MapInfo
are you using?
- Ian
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 31, 2004 6:11 PM
Subject: MI-L Returning XY Coordinates
>
>
>
>
>
> Hi Everyone
>
> I am looking for a tool that does the following function: When you click
> anywhere on a map, it returns the X & Y coordinates as text in the
cosmetic
> layer.
>
> If anyone knows of a tool that performs this type of function, can you
> please let me know?
>
> Thanks in advance for any help.
>
> Stella Randell
>
>
>
>
>
> ************************************************************
> Opinions contained in this e-mail do not necessarily reflect
> the opinions of the Queensland Department of Main Roads,
> Queensland Transport or Maritime Safety Queensland, or
> endorsed organisations utilising the same infrastructure.
> If you have received this electronic mail message in error,
> please immediately notify the sender and delete the message
> from your computer.
> ************************************************************
>
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 11217
>
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11235
*********************************************************************
This e-mail message, and any files transmitted with it, are
confidential and intended solely for the use of the addressee. If
this message was not addressed to you, you have received it in error
and any copying, distribution or other use of any part of it is
strictly prohibited. Any views or opinions presented are solely those
of the sender and do not necessarily represent those of the British
Geological Survey. The security of e-mail communication cannot be
guaranteed and the BGS accepts no liability for claims arising as a
result of the use of this medium to transmit messages from or to the
BGS. . http://www.bgs.ac.uk
*********************************************************************
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11238