Page 1 of 1

CTBstate rocks

Posted: 22 May 2013 15:09
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

Re: CTBstate rocks

Posted: 22 May 2013 15:50
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.

Re: CTBstate rocks

Posted: 22 May 2013 17:54
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... :)

Re: CTBstate rocks

Posted: 22 May 2013 17:57
by admin
For starters, I'd like a button not to show the current temperature in Cologne, but raise it! Please!

Re: CTBstate rocks

Posted: 22 May 2013 18:30
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

Re: CTBstate rocks

Posted: 22 May 2013 19:18
by binocular222
My XY's toolbar has only 1 button, which popup a menu listing most frequently used functionality

Re: CTBstate rocks

Posted: 22 May 2013 21:08
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

Re: CTBstate rocks

Posted: 23 May 2013 00:48
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.