Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Context Menu Trigger in QM
#12
I have tested the following code.

There are two cases:
Case A, when the distance from the mouse pointer to the left edge of the desktop is less than the custom menu width;
Case B, when the distance is greater than the custom menu width. The current difficulty is obtaining the width of the custom menu (myMenuWidth).
In post #11, the width is obtained by counting the number of characters in the menu items.

Can create a member function of the MenuPopup class to implement this functionality?
Is there a more elegant way to retrieve it?

Macro Explorer_Menu16
Trigger !v"" "#32768" /EXPLORER     Help - how to add the trigger to the macro
Code:
Copy      Help
out
int hwnd=TriggerWindow

ARRAY(int) a; win("" "#32768" "explorer" 0 0 0 a); if(a.len>1) ret
SetTimer(0 0 100 &sub._Timer)

_s=
;1 Test 1
;2 Test 2
;3 Test 3
;4 Test 4
;5 Test 5
;6 Test 6
;7 Test 7
;8 Test 8
;9 Test 9

int x w; GetWinXY(hwnd x 0 w); out F"x: {x};  w: {w}"
POINT p; p.y=ym

if x < myMenuWidth ;;How to get myMenuWidth?
,;A: When the mouse pointer is closer to the left edge of the desktop than the custom menu width
,p.x=w+xm; _i=ShowMenu(_s 0 p 0 0)
else
,;B: When the mouse pointer is farther from the left edge of the desktop than the custom menu width
,p.x=x; _i=ShowMenu(_s 0 p 0 8)

out _i

#sub _Timer v
function u1 u2 timer u3
if !IsWindowVisible(a[0]) && !(RealGetKeyState(1) or RealGetKeyState(2))
,KillTimer 0 timer
,EndMenu


Messages In This Thread
Context Menu Trigger in QM - by Davider - 08-17-2026, 11:11 PM
RE: Context Menu Trigger in QM - by Gintaras - 08-18-2026, 07:13 AM
RE: Context Menu Trigger in QM - by Davider - 08-18-2026, 09:45 AM
RE: Context Menu Trigger in QM - by Davider - 08-19-2026, 02:32 AM
RE: Context Menu Trigger in QM - by Gintaras - 08-19-2026, 03:43 AM
RE: Context Menu Trigger in QM - by Davider - 08-19-2026, 03:49 AM
RE: Context Menu Trigger in QM - by Davider - 08-19-2026, 05:19 AM
RE: Context Menu Trigger in QM - by Gintaras - 08-19-2026, 06:57 AM
RE: Context Menu Trigger in QM - by Davider - 08-19-2026, 11:43 PM
RE: Context Menu Trigger in QM - by Gintaras - 08-20-2026, 03:57 AM
RE: Context Menu Trigger in QM - by Davider - 08-20-2026, 11:48 AM
RE: Context Menu Trigger in QM - by Davider - 08-21-2026, 12:00 AM
RE: Context Menu Trigger in QM - by Davider - 08-21-2026, 10:25 PM
RE: Context Menu Trigger in QM - by Gintaras - 08-22-2026, 03:28 AM
RE: Context Menu Trigger in QM - by Davider - 08-22-2026, 04:20 AM
RE: Context Menu Trigger in QM - by Gintaras - 08-22-2026, 04:30 AM
RE: Context Menu Trigger in QM - by Davider - 08-22-2026, 04:50 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)