Page 1 of 1

Scriptable or modifyable User Buttons

Posted: 23 Jun 2024 09:45
by c0thirty
Is it possible (or could it be) to use scripting or condition checks to modify User-defined buttons? Such as to display a toggle state similar to the way some of the built-in toolbar buttons work, or to change the icon programmatically.

To give one example, the builtin Details button displays as toggled when the view is in Details mode, while the Thumbnails button shows as toggled when the view is in any of the 3 available thumbnail modes. I'd like to create separate user buttons for each different thumbnail modes and have the correct one show as toggled (either through the actual UI "toggle" state, or just by changing the icon), and also not have the behavior of the current Details/Thumbs buttons of cycling that same state off if clicked again. I think there's all kinds of other cool things that could be done too if one could programmatically change the name, icon, and maybe even click behavior of user-defined buttons via other scripts (though the buttons' own click scripts could account for that).

scripted icon-changing concept (courtesy of photoshop)
Image

Re: Scriptable or modifyable User Buttons

Posted: 24 Jun 2024 19:01
by eil
There is a script command to change button icon and pressed state, you can make a script that while making its actions changes the button's look. Check the Help file. But you can't make a button that will "react automatically" on something happening(like say change its look based on different selected item).

Re: Scriptable or modifyable User Buttons

Posted: 24 Jun 2024 23:54
by Norn
You can switch view modes and set buttons icons via events or shortcut keys.

Code: Select all

 //text ctbicon(,12);
 if (view() == 0) {
   ctbicon(":qns", 12);
 } elseif (view() == 6){
   ctbicon(":cfi", 12);
 } 

Re: Scriptable or modifyable User Buttons

Posted: 27 Jun 2024 12:07
by c0thirty
Thanks, this is exactly what I needed. I thought I'd searched the scripting reference for buttons, but I guess I missed it.
I added a catalog script to adjust the toggle state of the four buttons, and now each of them includes a catalogexecute() in their own script, plus I set it to be called on tab change in the Custom Event Actions, and it all works perfectly. :D