Page 1 of 1

Change pressed/unpressed state of custom button

Posted: 25 Aug 2018 13:19
by John_C
Here is a script (intended for custom button on toolbar) to switch between "Details" view and "Small Icons" view:

Code: Select all

"Toggle Details/Small Icons View"
    // Details     - 0 - #302;
    // Small Icons - 3 - #305;

    $path = get("Path");
    $mode = get("View");

    if ($path != "Computer") {
        if ($mode != 3) {
            #305;
            ctbstate(1);
        }
        else {
            #302;
            ctbstate(0);
        }
    }
Here are the buttons, as they are located on my toolbar:
buttons.png
The issue here is that I can't properly control pressed/unpressed button state. Try it yourself:

Make sure that custom button is unpressed. Then press 1st button, 2nd button, again 1st button, again 2nd button. You will see that they are properly toggled. When 1st button is pressed, the 2nd is automatically released. So, everything works correct.

Now press custom button and then press 1st or 2nd button. You will see that despite you pressed 1st or 2nd button, the 3rd is still pressed. Obviously, I want to fix it. Is it possible?

Cheers, John.

Re: Change pressed/unpressed state of custom button

Posted: 25 Aug 2018 13:34
by highend
It's a custom button^^ Ofc it's pressed state isn't influenced by any inbuilt button press...

You are free to recreate the behavior of the first (or any) button via scripting and control the
pressed state of that last custom button via ctbstate and it's index...

Re: Change pressed/unpressed state of custom button

Posted: 25 Aug 2018 13:40
by John_C
highend wrote:It's a custom button^^ Ofc it's pressed state isn't influenced by any inbuilt button press...

You are free to recreate the behavior of the first (or any) button via scripting and control the
pressed state of that last custom button via ctbstate and it's index...
Yes, I understand, thanks. Probably you know in which file the icons of default buttons are located? I failed to find it.

Re: Change pressed/unpressed state of custom button

Posted: 25 Aug 2018 13:51
by highend
The icons itself are stored inside XYplorer.exe

To use them in XY's scripting engine, find their internal name. E.g. via:
viewtopic.php?f=7&t=18178

Re: Change pressed/unpressed state of custom button

Posted: 25 Aug 2018 13:54
by John_C
highend wrote:The icons itself are stored inside XYplorer.exe

To use them in XY's scripting engine, find their internal name. E.g. via:
viewtopic.php?f=7&t=18178
Thanks :)