Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to show dialog 2 at coordinates relative to dialog 1
#1
hello , nice forum!
I have two dialogs, the first is the main dialog , the second is triggered by a button on the main dialog, is there a way to get the x y of the main dialog and have the 2nd dialog open at a certain x y on the main dialog no matter where main dialog may be dragged? if possible could I get an example if such a code exists? thanks in advance!
#2
1. Remove DS_CENTER style of the second dialog.
2. In ShowDialog that shows the second dialog, use handle of the first dialog as 4-th argument.

Examples

Function Dialog55
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("Dialog55" &Dialog55)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 6 8 180 14 "show another dialog at 0x0 from this dialog"
;4 Button 0x54032000 0x0 6 28 180 14 "show another dialog at 50x50 from this dialog"
;END DIALOG
;DIALOG EDITOR: "" 0x2030000 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,if(!ShowDialog("Dialog56" 0 0 hDlg)) ret
,case 4
,if(!ShowDialog("Dialog56" 0 0 hDlg 0 0 0 0 50 50)) ret
,case IDOK
,case IDCANCEL
ret 1

Function Dialog56
Code:
Copy      Help
;\Dialog_Editor

;BEGIN DIALOG
;0 "" 0x90C80244 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030000 "" "" ""


Forum Jump:


Users browsing this thread: 1 Guest(s)