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

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