Refer to custom button using its name instead of its index
Posted: 05 Jul 2019 10:21
I have three custom buttons on the toolbar to switch between "Details", "Small Icons" and "Thumbnails #1" views.
Button 1 code:
Button 2 code:
Button 3 code:
It works, but I don't like that buttons are referring each other using their index (for obvious reasons). I have tried to use
Button 1 code:
Code: Select all
"Toggle Details View"
$mode = get("view");
if ($mode != 0) {
#302;
ctbstate(1);
ctbstate(0, 2); // Turns off the "Small Icons" button.
ctbstate(0, 3); // Turns off the "Thumbnails #1" button.
}
Code: Select all
"Toggle Small Icons View"
$mode = get("view");
if ($mode != 3) {
#305;
ctbstate(1);
ctbstate(0, 1); // Turns off the "Details" button.
ctbstate(0, 3); // Turns off the "Thumbnails #1" button.
}
Code: Select all
"Toggle Thumbnails #1 View"
$mode = get("view");
if ($mode != 4) {
#306;
ctbstate(1);
ctbstate(0, 1); // Turns off the "Details" button.
ctbstate(0, 2); // Turns off the "Small Icons" button.
}
ctbname(), but it seems it doesn't intended for such referring. Have I missed something? Does ctbname() work for this task? Or is it exist another way?