Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Control position (X/Y) in QM dialog
#1
Sorry for this really stupid question but I can't figure this out.
I am trying to position the mouse pointer to the topleft corner of an inputfield after the dialog has been rendered.

If I remove "hDlg" from below, then it works spot on. But if I add it to enforce from dialog area it does not work.
I tried to get titlebar-height and add to 'y' but still isn't correct.
Code:
Copy      Help
GetWinXY id(3 hDlg) x y cx cy hDlg
mou x y hDlg

(using latest version of windows 10)

Function control_position_test
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Edit 0x54030080 0x200 55 49 96 13 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040601 "*" "" "" ""

str controls = "3"
str e3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_PAINT
,,;; Get the XY of inputfield and move mouse to it's topright corner
,,;; Below only works when 'hDlg' is removed (by removing: using screen area)
,,int x y cx cy
,,GetWinXY id(3 hDlg) x y cx cy hDlg
,,mou x y hDlg

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
you forgot flag 1 
 also can use timer instead of paint message
Code:
Copy      Help
,case WM_INITDIALOG
,SetTimer hDlg 1 100 0
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int x y
,,GetWinXY id(3 hDlg) x y 0 0 hDlg
,,mou x y hDlg 1
#3
AH, I knew I forgot something!
Thanks!!!
#4
this is an even easier solution 
GetWinXY is not needed
Code:
Copy      Help
,case WM_INITDIALOG
,SetTimer hDlg 1 100 0
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,mou 0 0 id(3 hDlg)
#5
That's a good one, I'll remember that one.
Thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)