CTBstate rocks

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
klownboy
Posts: 4480
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

CTBstate rocks

Post by klownboy »

I've been messing with the new scripting function CTBstate and it appears that you can easily assign a different scripts (e.g., XYscript menu or operation) for each state of the CTB for both a left click and a right click of the CTB. You can easily cycle back and forth to the different menus by re-clicking with the left or right mouse button. Very nice Don! See the simple example below. For the normal left click CTB assignment:

Code: Select all

     if (ctbstate() == 1) {
     ctbstate(0);
     ctbicon(":fore");
     load("<xyscripts>\Item Store.xys");
     } else {
     ctbstate(1);
     ctbicon(":back");
     load("<xyscripts>\PhotoCrop_both_axis.xys")
     }
For the right click CTB assignment:

Code: Select all

if (ctbstate() == 1) {
     ctbstate(0);
     ctbicon(":browsenetwork");
     load("<xyscripts>\LayoutManager\LMMenu.xys")";
     } else {
     ctbstate(1);
     ctbicon(":home");
     load("<xyscripts>\SessionManager.xys");
     }
Of course you'll have to ignore the script names obviously, and insert your own to experiment. You can even double click with the right or left mouse to get the different "state" and the resultant menu. This kind of thing probably works best for different menu scripts as oppose to taking direct actions. The only issue is coming up with meaningful icons (and tooltips) that properly describe the actions of the menus or operation. Maybe by changing the icon with "CTBicon" again after the operation or menu dispplay. Any ideas?
Thanks,
Ken

admin
Site Admin
Posts: 67247
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CTBstate rocks

Post by admin »

Note that the Clear button in the CTB edit dialog has a right-click menu where you can copy and paste "snippets" that define the whole button. That makes it easy to share buttons via the forum.

klownboy
Posts: 4480
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: CTBstate rocks

Post by klownboy »

Thanks Don, another new discovery.
Now to come up with ideas for use of get trigger, CTBstate and CTBicon for one CTB consolidated within one script resource file... :)

admin
Site Admin
Posts: 67247
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CTBstate rocks

Post by admin »

For starters, I'd like a button not to show the current temperature in Cologne, but raise it! Please!

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

Re: CTBstate rocks

Post by eil »

all these make me dream of a day when XY-for-beginners will have one XY-button, just like most web browsers :D
Win 7 SP1 x64 100% 1366x768|1900x1080

binocular222
Posts: 1424
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: CTBstate rocks

Post by binocular222 »

My XY's toolbar has only 1 button, which popup a menu listing most frequently used functionality
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

nerdweed
Posts: 652
Joined: 25 Feb 2012 07:47
Location: XY64 Latest Beta , Win 11, 96dpi, 100%

Re: CTBstate rocks

Post by nerdweed »

binocular222 wrote:My XY's toolbar has only 1 button, which popup a menu listing most frequently used functionality
If you don't mind can you share it please

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

Re: CTBstate rocks

Post by eil »

nerdweed wrote:
binocular222 wrote:My XY's toolbar has only 1 button, which popup a menu listing most frequently used functionality
If you don't mind can you share it please
he did it here.
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply