so, i just want a button to toggle between #304 and #307 on left click. I've searched, I've read things about making a script and loading it. In edit button I've put #304 in left click (and it works) but #307 in right click doesn't. But i just want the left click toggle option anyways. please and thank you.
all the view toggle buttons go from details to other option, why always details?
i just want a toggle button (i've searched)
Re: i just want a toggle button (i've searched)
use this for the left-click:get('view') returns current view mode as an integer. The code snippet translates to:
"if viewmode is not 2 (list), then switch to List view [#304], otherwise switch to Thumbs#2 view [#307]."
This has one unhandled case: if the view mode is neither List nor Thumbs #2, this will switch to List.
Code: Select all
if get('view') != 2 { #304; } else { #307; }
"if viewmode is not 2 (list), then switch to List view [#304], otherwise switch to Thumbs#2 view [#307]."
This has one unhandled case: if the view mode is neither List nor Thumbs #2, this will switch to List.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: i just want a toggle button (i've searched)
Thank you so much, i sincerely appreciate your help. exactly what i wanted. but just for icing on the cake, how would i get the right click menu that exists on the pre-made toolbar view buttons? and how could i access the current icons so i could create a half list half thumbs icon?
Re: i just want a toggle button (i've searched)
The following line will bring up the right click "Views" menu if you place it in the Right click edit box of your CTB.You are welcome to try this old script, ViewSwitcher.xys that I've used for years. It could stand an update, but it works and the icon changes to reflect the view mode. Left click of the assigned CTB cycles between List view and Detail view and the Right click cycles between Details and Thumbnail view.To use the script put load "<xyscripts>\ViewSwitcher.xys"; in both the left and right click edit boxes of a CTB. Feel free to modify it to change view modes to what you would like or anything else.
Code: Select all
button "views", 2
Code: Select all
$View = get("View");
if (<get trigger> == 1) {
if (ctbicon() != ":viewlist" AND $View != 2) {
ctbicon(":viewlist");
ctbstate(0);
#304; // go to List view
} else { // if list go to Detail view
ctbicon(":viewdetails");
ctbstate(1);
#302; }
end 1;
}
if (<get trigger> == 2) {
if ($View <= 3) {
ctbicon(":viewthumbs");
ctbstate(1);
#308; }
elseif ($View >= 4) {
ctbicon(":viewdetails");
ctbstate(0);
#302; }
else {
ctbstate(0);
#478; }
end 1;
}
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440
Re: i just want a toggle button (i've searched)
I didn't have much time, but the following may be a bit closer to what you were looking for. Left click toggles between list and thumbnail views and the Right click brings up the Views right click menu. The icon / state will change with the view, but if go to a different folder in a different view mode the icon will be off for a click or two but it will sync.As I said above, to use the script enter load "<xyscripts>\ViewSwitcher.xys"; in both the left and right click edit boxes of a CTB.
Code: Select all
$View = get("View");
if (<get trigger> == 1) {
if (ctbicon() != ":viewlist" AND $View != 2) {
ctbicon(":viewlist");
ctbstate(0);
#304; // go to List view
} else { // if list go to Thumbnail view
ctbicon(":viewthumbs");
ctbstate(1);
#307; }
end 1;
}
if (<get trigger> == 2) {
button "views", 2;
end 1;
}
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440
Re: i just want a toggle button (i've searched)
wow, that is more than i thought i could do. thank you so much. this is seriously the best community.
edit: i used your last suggested code.
edit: i used your last suggested code.
Re: i just want a toggle button (i've searched)
Following up on this thread, I want to do a similar thing, a bit simpler though.
I just want a button to toggle between SortFoldersApart setting. Without toggling the List/Thumbnail view.
This is how far I've come:
I cannot seem to be able to get rid of the List/Thumbnail View part of the code without messing it up.
Any help?
I just want a button to toggle between SortFoldersApart setting. Without toggling the List/Thumbnail view.
This is how far I've come:
$View = get("View");
if (<get trigger> == 1) {
if (ctbicon() != ":viewlist" AND $View != 2) {
ctbicon(":favfiles");
ctbstate(0);
Settingp "SortFoldersApart",1;
#304; // go to List view
} else { // if list go to Thumbnail view
ctbicon(":favs");
ctbstate(1);
Settingp "SortFoldersApart",0;
#307;
}
end 1;
}
if (<get trigger> == 2) {
button "views", 2;
end 1;
}
I cannot seem to be able to get rid of the List/Thumbnail View part of the code without messing it up.
Any help?
Re: i just want a toggle button (i've searched)
Code: Select all
if (get("#333")) {
ctbstate(0);
settingp "SortFoldersApart", 0;
} else {
ctbstate(1);
settingp "SortFoldersApart", 1;
}
One of my scripts helped you out? Please donate via Paypal
Re: i just want a toggle button (i've searched)
That was great! Thanks. I also added ctbicon rules to have a visual indicator as well. See here:
Code: Select all
if (get("#333")) {
ctbstate(0);
settingp "SortFoldersApart", 0;
ctbicon(":favs");
} else {
ctbstate(1);
settingp "SortFoldersApart", 1;
ctbicon(":favfiles");
}