Scriptable or modifyable User Buttons

Features wanted...
Post Reply
c0thirty
Posts: 32
Joined: 27 Oct 2021 14:28

Scriptable or modifyable User Buttons

Post 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

eil
Posts: 1814
Joined: 13 Jan 2011 19:44

Re: Scriptable or modifyable User Buttons

Post 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).
Win 7 SP1 x64 100% 1366x768|1900x1080

Norn
Posts: 483
Joined: 24 Oct 2021 16:10

Re: Scriptable or modifyable User Buttons

Post 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);
 } 
Windows 11 24H2 @100% 2560x1440

c0thirty
Posts: 32
Joined: 27 Oct 2021 14:28

Re: Scriptable or modifyable User Buttons

Post 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

Post Reply