Change pressed/unpressed state of custom button

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
John_C
Posts: 336
Joined: 16 May 2018 20:04

Change pressed/unpressed state of custom button

Post 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.
To see the attached files, you need to log into the forum.

highend
Posts: 14955
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change pressed/unpressed state of custom button

Post 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...
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: Change pressed/unpressed state of custom button

Post 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.

highend
Posts: 14955
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change pressed/unpressed state of custom button

Post 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
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: Change pressed/unpressed state of custom button

Post 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 :)

Post Reply