Dim nWID, nRow, nCol As Integer, sTab, sCol, sCmd As String, sValue As String, fValue As Float, nValue As Integer
nWID = FrontWindow()nRow = BrowserInfo(nWID, BROWSER_INFO_CURRENT_ROW)nCol = BrowserInfo(nWID, BROWSER_INFO_CURRENT_COLUMN)
sTab = WindowInfo(nWID, WIN_INFO_TABLE)sCol = ColumnInfo(sTab, "COL" & (nCol + 1), COL_INFO_NAME)
Do Case ColumnInfo(sTab, sCol, COL_INFO_TYPE) Case COL_TYPE_CHAR sValue = BrowserInfo(nWID, BROWSER_INFO_CURRENT_CELL_VALUE) sCmd = "Where (" & sCol & " = " & Chr$(34) & sValue & Chr$(34) & ")"
Case COL_TYPE_DECIMAL, COL_TYPE_FLOAT fValue = BrowserInfo(nWID, BROWSER_INFO_CURRENT_CELL_VALUE) sCmd = "Where (" & sCol & " = " & DeformatNumber$(Format$(fValue, "#.##########")) & ")"
Case COL_TYPE_INTEGER, COL_TYPE_SMALLINT nValue = BrowserInfo(nWID, BROWSER_INFO_CURRENT_CELL_VALUE) sCmd = "Where (" & sCol & " = " & Str$(nValue) & ")"
Case Else Call RBNNotificationShow("WindowHelper", GetResItemStr("ERR_ONLY_CHAR_AND_NUM_COLS_SUPPORTED"), Notify_Error, 5000) Exit Sub
sCmd = "Set Browse" & " Window " & nWID & " Filter " & sCmd Call DEBUGPrint(sCmd)Run Command sCmd
HelpMsg "\nEdit Asset"
I'm using MapInfo v15, but compiling to V12.5.Thanks,
Sub Test_Sub Note WindowInfo(FrontWindow(), WIN_INFO_TYPE)End SubThere 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
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! :)