hook marquee events
tony
A marquee hook would be useful.
In a window hook function, the only event associated with drawing a marquee is the final mouseup, so I can't use a combination of mousedown and mousemoved events with getmarquee to track the drawing of a marquee. A marquee event that replaces the unreported mousemoved would work.
Any chance?
I do this after the mouseup event to reset marquee coordinates on a panel.
Function Hf_imgTImageHook(iwH) // WindowHookFunction
STRUCT WMWinHookStruct &iwH
variable hookResult = 0, ctab
string wmode
switch(iwH.eventCode)
case 0: // active
wmode = GetUserData(k_imgDisplay,"","draw")
// drawing mode active -- pass thru and do nothing here
if (strlen(wmode) != 0)
break
endif
hookResult = 1
break
case 2: // graph being killed
KillWindow/Z $k_histGraphs
hookResult = 1
break
case 5: // mouseup
wmode = GetUserData(k_imgDisplay,"","draw")
// drawing mode active -- acknowledge and do nothing further
if (strlen(wmode) != 0)
hookResult = 1
break
endif
GetMarquee/W=$k_imgDisplay/Z
// has a marquee -- force update to coordinate values
if (v_flag)
ResetMQCoordinates(force=1)
endif
hookResult = 1
break
endswitch
return hookResult
end
Are you wanting to track the marquee dynamically. If so, is this not handled by setting a global flag that forces Igor to create globals that will track the marquee dynamically?
This is not to say that either a separate marquee hook function or an additional eventCode to track the marquee (e.g. case 88: marquee coordinates changed) would not be useful in its own right.
May 8, 2021 at 11:16 am - Permalink
Check the help for GetMarquee, and look at the V_marquee discussion under "Marquee Globals"
May 8, 2021 at 03:25 pm - Permalink
In reply to I do this after the mouseup… by jjweimer
Hmm, that sounds familiar. Yes, I was hoping to track dynamically. I already check for the mouseup to grab coordinates after drawing, that works fine.
May 8, 2021 at 03:26 pm - Permalink
Thanks, Jim, I had forgotten about that!
May 8, 2021 at 03:28 pm - Permalink
Tony- I'd be interested in the use case for this.
The window hook doesn't get the mouse moved events during marquee drawing because our internal code is tracking the mouse moved events and not letting the hook function have them first. It could be awkward to be in the middle of tracking the mouse and have the hook function start interfering.
May 10, 2021 at 09:37 am - Permalink
Use case:
User interface for selecting a ROI from a 1D plotted trace. Click and drag is the most efficient way, and efficiency counts if the user is fiddling around and adjusting their choice. It would be nice if marquee left and right were displayed in real time. Not altogether necessary, but nice. I could perhaps use the hook function together with a modifier key to monitor the click-and-drag, and skip the marquee altogether. But I don't want to prevent the marquee from working for its usual UI roles, and the marquee is convenient for making a quick selection. And there are not many suitable modifier keys that aren't already used in a graph window. No big deal, and probably better not to give me the marquee event if i can use it to screw up something else.
As it is I have the marquee mouseup triggering some setvars, and the setvars can be adjusted to change the marquee. That works nicely.
May 11, 2021 at 01:32 am - Permalink