Hi Mitchel,
I'm not sure why it may not work with a custom tool button, but taking a look at the MapBasic Reference guide, I found reference to using the ToolHandler procedure which works in conjunction with a special ToolButton. The button associated with a ToolHandler procedure is restricted; in that you cannot use custom icons or drawing modes with the ToolHandler's button.
There is a simple example program provided in the MapBasic v12.5 Reference Guide which demonstrates how to set up the ToolHandler procedure that will be called if you select the MapBasic tool, then click on a Map, Browser, or Layout window. I have attached the example program - please see attached zip file which contains the compiled .MBX tool and .MB file.
When the attached tool is run in MapInfo Pro, a button which looks like a crosshair or plus symbol will appear in the toolbar. If you click on this button to activate the tool, the mouse cursor should transform to reflect this symbol, then if you click on any row/column in the browser window it will return the specific column ID and row ID number relative to where you clicked.
For further details about the ToolHandler procedure, please see pages 650-651 of the MapBasic v12.5 Reference Guide. Hope this somewhat helps! :)
------------------------------
Dave Kuo
Pitney Bowes Australia Pty Ltd
Australia
------------------------------
Original Message:
Sent: 06-30-2019 22:05
From: Mitchel Fielding
Subject: Using Toolbutton on browser window
Thanks for the feedback Simon & Ashley, it sounds like this functionality is not available. The v12.5 Reference for the CommandInfo() function specifies behaviour with a Browser window, which sent me down this track, but I'll take another approach. Thanks again for your help.
Mitchel
------------------------------
Mitchel Fielding
Knowledge Community Shared Account
Original Message:
Sent: 06-30-2019 21:19
From: Ashley Crane
Subject: Using Toolbutton on browser window
Hi Mitchel & Simon,
I can replicate this behaviour (Toolbutton not returning click on Browser window). I'm not an expert on this MapBasic statement & have only seen this applied to a custom tool for a Map window, agree with the comments from Simon.
Regards,
Ashley
------------------------------
Ashley Crane
Regional Director, Software Support
Pitney Bowes
Original Message:
Sent: 06-30-2019 04:04
From: Simon Emmanuel
Subject: Using Toolbutton on browser window
Hi Micthel,
I believe ToolButton only works on map windows, as its meant to represent a Tool like Rectangle or Radius (correct if I'm wrong PB Experts).
You could use a PushButton instead. After making a selection or activating a window, you can then press the button to return the Win Type.
Thanks
------------------------------
Simon Emmanuel
Spatial Solutions Manager
Salmat Digital
Prestons
Original Message:
Sent: 06-29-2019 01:17
From: Mitchel Fielding
Subject: Using Toolbutton on browser window
Is anyone else seeing similar behaviour for a Toolbutton buttonpad? With the following handler routine:
Sub Test_Sub
Note WindowInfo(FrontWindow(), WIN_INFO_TYPE)
End Sub
There is a response when clicking in a Map window, but no response when clicking in a browser window.
This happens whether I compile with v12.5 or v15
------------------------------
Mitchel Fielding
Knowledge Community Shared Account
Original Message:
Sent: 06-27-2019 03:21
From: Mitchel Fielding
Subject: Using Toolbutton on browser window
Thanks Ashley, the problem I seem to be having is getting the toolbutton action to recognise the click in the browser window at all. The ToolButton handler doesn't trigger at all if I click within the browser window as the front window. Is there a specific parameter setting in the Create ButtonPad statement or elsewhere that's needed?
Toolbutton Calling
Edit_Asset
ID PB_EDIT
Icon 146
Cursor MI_Cursor_ARROW
Drawmode DM_Custom_Point
HelpMsg "\nEdit Asset"
I'm using MapInfo v15, but compiling to V12.5.
Thanks,
------------------------------
Mitchel Fielding
Knowledge Community Shared Account
Original Message:
Sent: 06-27-2019 00:43
From: Ashley Crane
Subject: Using Toolbutton on browser window
Hi @Mitchel Fielding,
Yes this would be possible, there's a couple of ways of approaching this, here's one idea:
- Use CommandInfo(CMD_INFO_Y) to extract the row that the User click on
- Use BrowserInfo() function to extract specific details about the position of the cursor
- Use Fetch to then get the corresponding record. e.g. Fetch Rec n where N is the RowID of the specific record
- Setup a loop to extract the values for each field of this record. For each field in the record you'll need to query to extract the data. The loop can be setup to be dynamic based on the number of fields (check out TableInfo([Table_Name], TAB_INFO_NCOLS)). There's an example of this at the end of the "Fetch Statement" description in the MapBasic help file
- Build a dialogue box with the appropriate controls, prepopulate controls with the values extracted as part of Step 4
Hope this helps!
Thanks, Ashley
------------------------------
Ashley Crane
Regional Director, Software Support
Pitney Bowes
Original Message:
Sent: 06-26-2019 20:27
From: Mitchel Fielding
Subject: Using Toolbutton on browser window
Hi Simon, I want to present a pop-up dialog box with fields that depend on the row that was selected in the browser window.
I'm currently doing this with a map window, but want a mechanism to provide the same functionality for records that don't have graphical data.
Thanks,
------------------------------
Mitchel Fielding
Knowledge Community Shared Account
Original Message:
Sent: 06-26-2019 19:50
From: Simon Emmanuel
Subject: Using Toolbutton on browser window
Hi Mitchel,
It would help to know what you are trying to achieve with your custom tool button.
------------------------------
Simon Emmanuel
Spatial Solutions Manager
Salmat Digital
Prestons
Original Message:
Sent: 06-26-2019 18:55
From: Mitchel Fielding
Subject: Using Toolbutton on browser window
The documentation for CommandInfo indicates that Toolbutton can be used on browser windows (e.g. CMD_INFO_X/Y should return column or row). What is needed to make this work? After clicking toolbutton, with the browser window in front, the cursor still just changes to editing table fields in the browser window.
Thanks,
Mitchel
------------------------------
Mitchel Fielding
Knowledge Community Shared Account
------------------------------