GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Dynamic icon for three button

Is it possible to dynamically set the icon of a three buttons menu button?
For a standard menu button we can use the code below, however a three buttons menu button there is no place to put instructions.

@icon:#default:smiley,$glob:myvar

If this is not possible I could switch from a three button to a single menu button. What is the best way to pass what mouse button was pressed to a custom function?

Not possible for the top-level icon of a three-button. A three-button always has a static icon until it is being clicked with the mouse, where the icon and label will change to reflect the LMB/RMB/MMB button inside it as appropriate.

What's meant by custom function in this context? A user command, script command, or something else?

im calling this kind of custom function. gpsoft.com.au/help/opus11/in ... ommand.htm.

How are you calling it?

There are a few ways you can do it with a script command, but for most flexibility you may not want to think in terms of mouse buttons but in terms of behaviours: Pass the script command different arguments when called in different ways (e.g. mouse buttons).

Currently i call the function from a three button, but as I cant make the icon dynamic I am thinking of making the button a standard button.
Could you point me to a sample of how you would code a standard button to pass different params to a function if the mouse is down?

Normal buttons run on a left click.

To handle LMB/MMB/RMB you use a three-button, where you'd just run the script command with different arguments on each button.

If you're not using a three-button then there is only LMB. You can use Ctrl, Shift, Alt as modifiers, but not other mouse buttons.

I follow now, that should work. Thanks.

Being able to set a three-button's icon to be dynamic would be a useful addition. I prefer the way a three button works compared to using command modifiers.

My plan here was to update the buttons used in External Compare and Merge Tools. The script stores the the path to the compare/merge tool in a global variables. I want to have the icon change based on the path being set. Setting the icon to colored if the path is set and black and white if not set.

The problem with this approach is I store the compare and merge paths in separate variables.
Having a single button will be miss leading, the icon will only be based on the compare status not the merge.

This brings me back to wanting to have the icon for a three buttons equal to the left button.
Would this be possible to add as a feature enhancement?

Regards

That seems like overkill to me. If the path isn't set, it only has to be set once, and you can tell the user it needs setting when they try to use it.

You are probably correct. I have updated the buttons for the compare script. I stayed using the three button. You see a gray icon if the path is not yet set when you hold down a button. I think it adds some value.