Currently both pressing and releasing trigger the event. And it seems to invalidate the double click event.
Sometimes the user needs to hold down the left button to drag the image, so I think this should be improved.
Which event do you mean? The one chosen in Preferences / Viewer / Standalone Viewer / Mouse Buttons?
If I set Left Button to "Advance to next image" and click and release the mouse button on the viewer, it only advances one image.
Yes, I created the following code as a user command toggleFit
@if:Show VIEWERCMD=zoom,fit
Show VIEWERCMD=zoom,100
@if:else
Show VIEWERCMD=zoom,fit
The weird thing is that after restarting the machine releasing the left button does not trigger the event again, I have not run the script that changes the hotkey.
I restored the default events and tried AutoHotkey:
#Requires AutoHotkey v2
#HotIf winActive("ahk_class dopus.viewpicframe")
drag := 0
~LButton::
{
if !KeyWait("LButton", "L T0.3") {
global drag := 1
tooltip "dragging"
}
}
LButton up::
{
global drag
if (A_PriorHotKey = A_ThisHotkey && A_TimeSincePriorHotkey < 400) {
tooltip "dblclick"
return
} else if (!KeyWait("LButton", "D T0.5") && !drag) {
;run '"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /acmd=toggleFit' ; invalid
send "!{space}"
tooltip "Click"
}
drag := 0
}
#HotIf
That looks like an issue with your AutoHotkey script, which Opus has nothing to do with really.
OK, but I want to request that the event be triggered only when the left button is released...
But I can currently do it using AutoHotkey script.
You are requesting something that goes backwards of every "click event" in every application.
One example : take whatever software that can save a file through a dialog, click the save button
and hold it : does it trigger the click event (and saving the file) before you release the mouse button ?
You can even try and then move your mouse away from the button before releasing and check what's happening ?
Answer is nothing ! Because traditionally the click event is trigger on mouse button release, and if you're not on the button anymore, it leads to nothing happening.
I doubt (and probably wouldn't want) Opus will go that way.
EDIT : It looks like I misread your request. But it should already only trigger on mouse click release. I guess I don't get what is your problem. On what button do you click that triggers the click event before you release it ?
I still don't understand why.
Going back to the original post:
That doesn't seem to be true with Opus's own mouse button configuration events in Preferences. (Unless it only happens for a particular event/action choice which I haven't tested. If so, tell us which one to try.)
If you're talking about having both Opus and AHK configured to trigger events on the same window for the same mouse button, that is probably unwise but going to come down to how you've written the AHK script.
This confuses me, because dragging simply wouldn't work if the event was set to drag and only happened on button-up. You can only drag something while the button is down.
Forgot about that, restarted the machine and it no longer happens, I don't know why...
For the behavior, the AHK script I posted can be explained:
In fact drag is default, I don't need to change it, because sometimes I need to drag the image.
Quickly click the left button to trigger a single click event, and double-clicking within a short period of time triggers a double-click event.
(A quick double-click is required to trigger a double-click event. This can be adjusted by judging the key delay. My knowledge is limited, and there may be other better methods.)
In fact drag is default, I don't need to change it, because sometimes I need to drag the image.
Quickly click the left button to trigger a single click event, and double-clicking within a short period of time triggers a double-click event.
In the viewer you can have up to two actions on the left mouse button:
- Click
- Double-click
You can't have three. If you've bound single-click to drag, you can't make something else happen on a single-click, because it's already configure to drag the image.
Use another mouse button, or a hotkey, or the toolbar for the other action.
If the single-click event is configured to run a command, the double-click event will be unavailable.
I use the AutoHotkey script above as a solution.
Making it trigger on button up instead of down wouldn’t change that.