[Bug?] Question about CTB right-click and load command

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

[Bug?] Question about CTB right-click and load command

Post by autocart »

Help file (Main Topics|Toolbar) wrote:On right-click: Here you can define a separate script for a user button's right-click event. It is merged with the standard right-click menu for user buttons. This means you can have user buttons that do one thing on left-click and pop lots of additional options on right-click.

There's special support for the load command. Example (in field On right-click):

load "test", "foo" //load script labeled "foo" from "test.xys"

The file "test.xys" will be loaded and parsed, and then the context menu is shown, with the standard items (Click, Edit... etc) appended at the bottom. If the file contains only one script, it is not executed directly (as it would be in a "non-Right-Click" load statement) but shown in the menu.
Not sure if I understand this correctly.
Ofc, I tried it, but before I go with the results of my test, I want to make sure that there is no bug and it all works correctly:
The help says in my understanding ... well, I am really not sure what it says. My tests show that regardless of how the load command is used (with or without "foo"), as long as it is the first line in a normal (non-multi) script inside the right-click field, then that script is immediately executed on right click on the CTB without context menu. If the script starts with a different command than load or if it is a multi-script then the context menu is popped.

So, is that behaviour correct and what does that "special support" mean?
Many thx in advance, S.
Last edited by autocart on 22 Oct 2021 12:04, edited 1 time in total.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: [Bug?] Question about CTB right-click and load command

Post by autocart »

Ok, I think this should actually go into the Bugs forum.
I now tried it exactly in the way of the help's description inside a fresh instance.
Here is the CTB snippet of the button I used:

Code: Select all

Snip: CTB 1
  XYplorer 22.30.0202, 22.10.2021 11:59:32
Action
  NewUserButton
Name
  
Icon
  
ScriptL
  
ScriptR
  load "test", "foo" //load script labeled "foo" from "test.xys"
FireClick
  0
Here is the test.xys file I used:
test.xys
(19 Bytes) Downloaded 37 times

Code: Select all

"foo"
 echo "foo";
On right click on the button, the echo is executed immediately. No context menu is shown. Is that behavior correct? I think, that the helps says differently.

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: [Bug?] Question about CTB right-click and load command

Post by klownboy »

It may be due to the tweak:

Code: Select all

; Tweak: no Click, Edit, Customize Toolbar
CTBNoRClickDefaultCommands=1
The help text was probably written well before we asked for that tweak years ago and maybe should have been clarified, but then again I'm not sure Don incorporates knowledge of specific tweaks in the help file. In my opinion that tweak should be a default anyway.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: [Bug?] Question about CTB right-click and load command

Post by highend »

@Ken
But he's using a fresh instance so there wouldn't be any tweaks set
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: [Bug?] Question about CTB right-click and load command

Post by admin »

Yeah, looks like a bug to me. Apparently it was introduced in v14.80.0235 - 2015-02-14 12:26. Next beta should fix it.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: [Bug?] Question about CTB right-click and load command

Post by autocart »

admin wrote: 22 Oct 2021 13:42... in v14.80.0235 - 2015-02-14 12:26. Next beta should fix it.
:kidding: thx for fixing
EDIT: You could also update the help to fit program behavior. I dont mind.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: [Bug?] Question about CTB right-click and load command

Post by autocart »

Either way, if I may include a wish, the important thing for me would be that there remains a way of immediately executing a script on right click without the context menu.

The whole reason why I started this thread was to be on the safe side and not code something relying on immediate execution on right click only to find out later that it was a bug and gets changed all of a sudden. But I do want the immediate action without context menu in some way, please.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: [Bug?] Question about CTB right-click and load command

Post by admin »

This tweak should do that for you in v22.30.0204:

Code: Select all

CTBNoRClickDefaultCommands=1

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: [Bug?] Question about CTB right-click and load command

Post by autocart »

That tweak would affect all CTBs, wouldn't it?
Besides, I cannot change that tweak programmatically with SC, right?

Still not sure what the help text, quoted in the first post, really means, but in order to not change too much around, here is a suggestion:

If load "test", "foo" //load script labeled "foo" from "test.xys" is used as the first line in a right click script, then pop the context menu with that load command plus the default commands, just as the help seems to say.
If there is a normal load command used as the first line, e.g. load "test" then just immediately execute that script.

We might also want to ask FluxTorpedo, so that this does not become incompatible with his SessionManager button. I think his script is the most widely used script.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: [Bug?] Question about CTB right-click and load command

Post by admin »

Hmm, I don't know. Why change anything? The help text just tries to say that a (multi)-script file opened by load is presented as menu item(s).

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: [Bug?] Question about CTB right-click and load command

Post by autocart »

admin wrote: 22 Oct 2021 16:39 Hmm, I don't know. Why change anything? The help text just tries to say that a (multi)-script file opened by load is presented as menu item(s).
Ok, maybe it does try to say that. Not conviced that it succeeds in trying that. But it does not matter much. I am glad you looked into it and I will see how the next beta turns out and give more feedback if it feels right or necessary. Thx for your effort.

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: [Bug?] Question about CTB right-click and load command

Post by klownboy »

Flux's Session Manager can be used with a line like this to load a specific "session". It's refered to in his Session Manager thread. I use it successfully on right click to return to my normal arrangement.

Code: Select all

global $DYN_InpSess = "Normal"; load "SessionManager.xys", "_Load";
It currently make no difference whether the global statement is placed on a separate line (to make it a so-called multi line script). Obviously there's a semicolon ";" between the global statement and the load statement which includes a label.

In any case, I know there are plenty of scripts floating around including mine that use a SC load with a label on "right" click. The help wording may be need some loving care, but I'm not so sure we should be actually changing the way it CTB right click currently functions. Autocart have you checked whether the tweak actually affects this particular load label right click behavior in any way.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: [Bug?] Question about CTB right-click and load command

Post by autocart »

klownboy wrote: 22 Oct 2021 17:15 Autocart have you checked whether the tweak actually affects this particular load label right click behavior in any way.
Whether CTBNoRClickDefaultCommands is set to 0 or 1 does currently (v22.30.0203) not affect the behavior of right clicking on the CTB with the example above (CTB snippet and test script).

I also want to emphazise again - besides, that I don't know why CTBNoRClickDefaultCommands was mentioned to begin with - that I am happy with the way XY's right click behavior on CTB is right now. I DON'T want it to change. It just does not fit together with the help and I don't want to write a script for the current behavior going against help, and then find out the next day that that script was actually based on a bug which gets "fixed" and then I have to rewrite the script - or worse - the script will all of a sudden just not work anymore with no option to rewrite because the "bug" was "fixed" and XY does not support my intentions anymore and I wrote it for nothing. But maybe I am starting to repeat myself too much.
Last edited by autocart on 22 Oct 2021 17:36, edited 1 time in total.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: [Bug?] Question about CTB right-click and load command

Post by admin »

I changed it so that it matches what the help file seems to say ( :) ). The new behavior seems to make sense to me, but I'm not really using these functions myself in daily life, so let's see how YOU like it...

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: [Bug?] Question about CTB right-click and load command

Post by klownboy »

No sorry autocart, you had mentioned already that you were testing in fresh so in that case the tweak is "0". Yes, the help should reflect what really happens. I only mentioned the tweak because sometimes changes are made that unintentionally affect the behavior of something else. In that, is it possible that before the tweak coding was put in the code, that help explanation may have been true. In any case it doesn't matter now. Sorry if I was being pain (and old).
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Post Reply