Bill,

My best guess is that this has been changed some time ago. I tried compiling 
your application with MapBasic 4.0 and ran it in MapInfo 6.0.
But the problem was the same, when you moved the costum tool on to the Briwser 
window and clicked, it changed into the Selector tool

So this functionality doesn't seem to be supported anymore. You can use the 
tool in Mapper Windows and Layout windows.

I even tried copying some MapBasic code from the MapBasic User Guide showing 
how to handle the use of a tool button in another window than a map. And this 
didn't work either.

Sub Main

        '...

        Create ButtonPad "Custom" As
                ToolButton
                Icon MI_ICON_LINE
                DrawMode DM_CUSTOM_LINE
                Cursor MI_CURSOR_CROSSHAIR
                Calling draw_via_button
                HelpMsg "Draws a line on a Map window\nDraw Line"
                Show

End Sub

Sub draw_via_button
Dim x1, y1,x2, y2 As Float
        If WindowInfo(FrontWindow(),WIN_INFO_TYPE) <> WIN_MAPPER Then
                Note "This tool may only be used on a Map window. Sorry!"
                Exit Sub
        End If
        ' Determine map location where user clicked:
        x1 = CommandInfo(CMD_INFO_X)
        y1 = CommandInfo(CMD_INFO_Y)
        x2 = CommandInfo(CMD_INFO_X2)
        y2 = CommandInfo(CMD_INFO_Y2)
        ' Here, you could create objects based on x1, y1, x2, and y2.
End Sub

So it lookds as if MapInfo has disabled this

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Bill Thoen
> Sent: Monday, January 02, 2006 6:51 PM
> To: [email protected]
> Subject: [MI-L] Sensing a Browser Window with a Custom Toolbutton
> 
> Using MapBasic, does anyone know how to get a custom tool 
> button to react to a browser window? I can get the Mapbasic 
> Tool to do this, but the exact same code used in a custom 
> tool procedure does not work. What's the deal?
> 
> Here is a demo illustrating the problem. Compile and run and 
> open a browser and a mapper and notice the difference in how 
> the Mapbasic toll reacts to clickking on a browser vs the 
> reaction of the cutom tool.
> 
> ' BrowserTool.mb
> ' Test of tool button's reaction to browser
> 
> Include "MapBasic.def"
> Include "Menu.def"
> Include "Icons.def"
> 
> Define TOOLBTN_BROWSER 900
> 
> Declare Sub Main
> Declare Sub MnuExit
> Declare Sub MnuPickBrowser
> Declare Sub ToolPickBrowser
> Declare Sub MnuMapBasic
> Declare Sub ToolHandler
> 
> Sub Main
>   Create Menu "BrowserTool" As
>     "Activate MapBasic Tool" Calling MnuMapBasic,
>     "Activate Custom Browser Tool" Calling MnuPickBrowser,
>     "E&xit" Calling MnuExit
>   Alter Menu Bar Add "BrowserTool"
>   
>   Alter ButtonPad ID 3 Add
>   ToolButton Calling ToolPickBrowser
>     ID TOOLBTN_BROWSER
>     Cursor MI_CURSOR_CROSSHAIR
>     Icon MI_ICON_LETTERS_T
>     Drawmode DM_CUSTOM_POINT
> End Sub
> 
> Sub MnuExit
>   Terminate Application "BrowserTool.MBX"
> End Sub
> 
> Sub MnuPickBrowser
>   Alter Button ID TOOLBTN_BROWSER Check
>   Run Menu Command TOOLBTN_BROWSER
> End Sub
> 
> Sub MnuMapBasic
>   Alter Button ID M_TOOLS_MAPBASIC Check
>   Run Menu Command M_TOOLS_MAPBASIC
> End Sub
> 
> Sub ToolPickBrowser
> Dim nWin As Integer
>   nWin = FrontWindow()
>   Do Case WindowInfo(nWin, WIN_INFO_TYPE)
>     Case WIN_BROWSER
>       Note "Window type: Browser"
>     Case WIN_MAPPER
>       Note "Window type: Mapper"
>     Case Else
>       Note "Window type: unknown"
>   End Case
> End Sub
> 
> 
> Sub ToolHandler
> Dim nWin As Integer
>   nWin = FrontWindow()
>   Do Case WindowInfo(nWin, WIN_INFO_TYPE)
>     Case WIN_BROWSER
>       Note "Window type: Browser"
>     Case WIN_MAPPER
>       Note "Window type: Mapper"
>     Case Else
>       Note "Window type: unknown"
>   End Case
> End Sub
> 
> _______________________________________________
> MapInfo-L mailing list
> [email protected]
> http://www.directionsmag.com/mailman/listinfo/mapinfo-l
> 
> 
> 
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to