DEFINE CONTEXT MENU OF Win open on wrong Monitor

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

DEFINE CONTEXT MENU OF Win open on wrong Monitor

Post by AUGE_OHR »

hi,

not sure it i have ask before but Position of CONTEXT MENU appear on wrong Monitor

my 2nd Monitor (WQHD) is LEFT of my 1st Monitor (Full-HD) when run app so Position is "negative"
App is running on 2nd Monitor (left Side) but CONTEXT MENU open on 1st Monitor (right Side)
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DEFINE CONTEXT MENU OF Win open on wrong Monitor

Post by AUGE_OHR »

hi,

i rember i have fix it ...

on "that" PC was a "clean" HMG Version so my "fixes" are not present

c:\hmg.3.4.4\SOURCE\h_windows.PRG
WM_CONTEXTMENU.JPG
WM_CONTEXTMENU.JPG (145.61 KiB) Viewed 2267 times
search for all (WM_LBUTTONDOWN, WM_MOUSEMOVE and WM_CONTEXTMENU)

Code: Select all

*         _HMG_MouseRow := HIWORD( lParam )
*         _HMG_MouseCol := LOWORD( lParam )
and change it to

Code: Select all

// change by Jimmy
         aPos := GetCursorPos()
         _HMG_MouseRow := aPos[1] // GetCursorRow()
         _HMG_MouseCol := aPos[2] // GetCursorCol()
Context Menu now Popup on "other" Positon but on 1st Monitor so still Position is wrong ...

c:\hmg.3.4.4\SOURCE\c_windows.c
GetCursorPos.JPG
GetCursorPos.JPG (37.85 KiB) Viewed 2267 times
HB_FUNC ( GETCURSORPOS )
IMHO Original is wrong

Code: Select all

   hb_storvni( pt.y, -1, 1 );
   hb_storvni( pt.x, -1, 2 );
when change to

Code: Select all

   hb_storvni( pt.x, -1, 1 );
   hb_storvni( pt.y, -1, 2 );
it does return right Position on "left" Monitor in right Position
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DEFINE CONTEXT MENU OF Win open on wrong Monitor

Post by AUGE_OHR »

hi,

when read what i wrote about c_windows.c / GETCURSORPOS i´m not sure any more about X/Y ...

better when using

Code: Select all

   _HMG_MouseRow := GetCursorRow()
   _HMG_MouseCol := GetCursorCol()

Code: Select all

   _HMG_SYSDATA[ 191 ] := GetCursorRow()
   _HMG_SYSDATA[ 192 ] := GetCursorCol()
you are on "safe" Side

forgot

Code: Select all

*  TrackPopupMenu( _HMG_SYSDATA[ 74 ] [ i ], LOWORD( lparam ), HIWORD( lparam ), hWnd )
   TrackPopupMenu( _HMG_SYSDATA[ 74 ] [ i ], GetCursorCol(), GetCursorRow(), hWnd )
have fun
Jimmy
Post Reply