Ah, simple enough. Thank you.
Original Message:
Sent: 04-30-2025 01:10
From: Peter Møller
Subject: Adding Multiple Key Gestures to Control Button
Hey Brandon
I can see that for the cursor, we have two parameters:
'IRibbonToolButtonControl
Define PROPERTY_CURSOR "Cursor" 'string
Define PROPERTY_CURSORID "CursorID" 'Integer
You should be using PROPERTY_CURSORID
for the defines as they represent IDs.
The string-based property is for a cursor file.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 04-29-2025 16:47
From: Brandon Shepherd
Subject: Adding Multiple Key Gestures to Control Button
Thanks Peter,
I think the CommandInfo() feature is limited to toolbuttons, and control buttons themselves can only have one key gesture.
I've been experimenting but having trouble with the other Ribbon Control Properties beyond the simple ones here. In order to get the CommandInfo() function to work I believe I need to use a tool button. However, I cant seem to set certain Properties that rely on Icons.def. To start simple I am trying to set the PROPERTY_CURSOR to MI_CURSOR_CROSSHAIR. This returns a message stating only "An Unknown Error has Occurred". Likewise trying "MI_CURSOR_CROSSHAIR" or 138 results the same.
I had similar experience with other properties. One I appear to have working is the DRAWMODE, using what would be the same method for setting a cursor. PROPERTY_DRAWMODE : DM_CUSTOM_POLYGON
I know the RibbonControls.def now has its own set of images, but are all the new Properties intended to work with Icons.def where needed?
------------------------------
Brandon Shepherd
Knowledge Community Shared Account
Shelton CT
Original Message:
Sent: 04-24-2025 03:02
From: Peter Møller
Subject: Adding Multiple Key Gestures to Control Button
Hey Brandon
I wonder if you can use the CommandInfo()
function to determine if the user held down the Ctrl or Shift key when they clicked on the control?
CMD_INFO_SHIFT
: Logical value: TRUE if the user held down the Shift key while clicking.
CMD_INFO_CTRL
: Logical value: TRUE if the user held down the Ctrl key while clicking.
I think it was designed to work with ToolButtons so I'm unsure if it works with any controls/buttons.
PS: But that might conflict when the keyboard shortcuts...
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 04-17-2025 13:27
From: Brandon Shepherd
Subject: Adding Multiple Key Gestures to Control Button
Hello, I have created a simple script to automatically select and find the next item in a table. Is there a way to add multiple key gestures to a single button, in this case to allow users to select and find the previous item? Better yet, is it possible to assign key gestures to a running script that does not require a Ribbon control? This way the script would be in the background, waiting for specific input to carry out a procedure.
Include "Mapbasic.def"
Include "RibbonControls.def"
'=============================================================================================
Declare Sub Main
Declare Sub Test_Sub
Declare Sub EndHandler
'=============================================================================================
Sub Main()
Set Ribbon Tab TAB_SPATIAL
Group "grpTest" Caption ""
Controls ( Add
Control "Testing" Caption "Review"
Type CTRL_TYPE_BUTTON
Size Large
Properties(
PROPERTY_CALLINGHANDLER : "Test_Sub",
PROPERTY_KEYGESTURE: "Ctrl+Alt+F",
PROPERTY_LARGEICON : MI_IMG_APP_RUNMAPBASIC_32
)
)
End Sub
'=============================================================================================
Sub Test_Sub
OnError goto ErrorOccured
dim myrow as integer
If SelectionInfo(SEL_INFO_NROWS) = 0 Then
select obj from "ReviewTable" where RowID = 1
Set Map Zoom Entire Selection
Else
myrow = CommandInfo(CMD_INFO_ROWID)
select obj from "ReviewTable" where RowID = myrow + 1
Set Map Zoom Entire Selection
End If
Exit Sub
ErrorOccured:
Note Error$()
End Sub
'=============================================================================================
Sub EndHandler
end sub
'=============================================================================================
------------------------------
Brandon Shepherd
Knowledge Community Shared Account
Shelton CT
------------------------------