Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to call multiple dialogs simultaneously.
#1
Project:
Displaying multiple dialogs at the same time inside a Main dialog.

Information:
Main Dialog opens and contains:
Dialog A would open in the upper left corner
Dialog B would open in the upper right corner
Dialog C would open in the lower left corner
Dialog D would open in the lower right corner

Dialogs A-D do not move on their own, they follow the parent Main Dialog
Dialogs A-D resize evenly and consistently each fill 1/4 of the Main Dialog

All I can get so far is the dialogs to open one after another after hitting the OK button when I try to call all four. Basically how do you simultaneously call multiple dialogs? And then how does the AutoSizing and positioning works

Thanks,
Jimmy Vig

***FINISHED***

.qml   ReSizing.qml (Size: 4.24 KB / Downloads: 719)
#2
I do not know what I am doing I just wanted to make this and maybe give you something to play with.

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

str controls = "4"
if(!ShowDialog("Four_Into_One_Dialog_TheVig" &Four_Into_One_Dialog_TheVig)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,DT_Page 0 Dialog_0_TheVig(0 0 hDlg 3)
,DT_Page 0 Dialog_1_TheVig(0 0 hDlg 3)
,DT_Page 0 Dialog_2_TheVig(0 0 hDlg 3)
,DT_Page 0 Dialog_3_TheVig(0 0 hDlg 3)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_0_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 14 19 ""
;3 Static 0x54000000 0x0 2 2 48 12 "A"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_0_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 81 20 ""
;3 Static 0x54000000 0x0 32 4 48 13 "B"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_2_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 42 114 ""
;3 Static 0x54000000 0x0 2 98 48 13 "C"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_3_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 137 107 ""
;3 Static 0x54000000 0x0 86 90 48 12 "D"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1
#3
This definitely gets a start...At least I've got the four dialogs coming up now.

I had to modify your example quite a bit to position everything right. It all looked jumbled and on top of each other when I ran it. I'm going to try and re-copy all of the functions again just in case I made an error.

The main dialog isn't sizable...
I've looked in the styles and can't seem to figure out which one of those does the trick. I haven't checked the forum yet. I think I've seen example using this...an example for SysListView32 had a resizing option...I break that apart.

I'll also have to figure out how to make the individual dialogs follow the parent, but I think that forum post on SysListView32 does that too.

Thanks for the code to fire all four dialogs...I was stuck on it before, I might be able to figure out on my own now since I have a little kick! Any other ideas in the mean time are welcome.

Thanks,
Jimmy Vig
#4
http://www.quickmacros.com/forum/showthread.php?tid=769

What do you know...this has a lot of relevant information that I could have used in the first place....

It seems like WS_THICKFRAME is what does the resizing. Is this right? I played around turning things on and off and this is what needs to be turned on to make a window sizable. Odd...I'm still going to play around a bit to make sure this is it.

Yep...if everything is off except for WS_THICKFRAME the window has resizing. If you turn it off, no resizing. Here I thought that THICKFRAME would be just an aesthetic choice, but it is way more important.
#5
Sorry when I used the move command all of the dialogs moved to the exact same place no matter where I told them to move; I think that this had something to do with hDlg, so I just left them THICKFRAM so you could move them.

The project that you are working on sounds very interesting to me and I think that we can help each other out as well. I will give it another go.
#6
OK this is better

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

str controls = "4"
if(!ShowDialog("Four_Into_One_Dialog_TheVig" &Four_Into_One_Dialog_TheVig)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 265 163 "Dialog"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "0" ""

ret
;messages
sel message
,case WM_INITDIALOG
,DT_Page 0 Dialog_0_TheVig(0 0 hDlg 3)
,DT_Page 0 Dialog_1_TheVig(0 0 hDlg 3)
,DT_Page 0 Dialog_2_TheVig(0 0 hDlg 3)
,DT_Page 0 Dialog_3_TheVig(0 0 hDlg 3)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_0_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 54 19 "Dialog_0"
;3 Static 0x54000000 0x0 2 2 48 12 "A"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,mov 100 0 child("Dialog_0" "#32770" win("Dialog" "#32770") 0x1)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_0_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 60 20 "Dialog_1"
;3 Static 0x54000000 0x0 4 4 48 13 "B"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,mov 0 50 child("Dialog_1" "#32770" win("Dialog" "#32770") 0x1)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_2_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 57 26 "Dialog_2"
;3 Static 0x54000000 0x0 2 4 48 13 "C"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,mov 0 50 child("Dialog_2" "#32770" win("Dialog" "#32770") 0x1)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

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

str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_3_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

;BEGIN DIALOG
;0 "" 0x10040644 0x0 0 0 55 19 "Dialog_3"
;3 Static 0x54000000 0x0 4 4 48 13 "D"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,mov 200 200 child("Dialog_3" "#32770" win("Dialog" "#32770") 0x1)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;sel wParam
,;case ...
,;...
ret 1

I do not know why A and B are reversed but at least this might give you another piece of the puzzle.
#7
Where did you get:
Time_Runner Wrote:Function Dialog_3_TheVig
Code:
Copy      Help
str controls = "3"
str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_3_TheVig &controls wParam 1 WS_CHILD 0 0 2 lParam)
,case 1 ;;on OK of the parent dialog
,hDlg=lParam
,DT_GetControls hDlg &controls
,out e4

This seems to get the job done:
Function Dialog_2_TheVig
Code:
Copy      Help
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_2_TheVig &controls wParam 1 WS_CHILD 0 0 100 100)

You can set the position in the call right here with the x y position in the show dialog.
ShowDialog([macro] [dlgproc] [controls] [hwndowner] [flags] [style] [notstyle] [param] [x] [y] [icon] [menu])

You are passing Y position through the lParam and then the hDlg through the wParam in parent Four_Into_One_Dialog_TheVig to the other dialogs.

Getting everything to resize with the main dialog is the real trick.
I would imagine it has something to do with: case WM_SIZE

But the only way I can seem to determine the size of the other dialogs is though the "BEGIN DIALOG" section...I can't just smack a variable in there because it only seems to accept hard numbers.

i.e.
;0 "" 0x124C0644 0x8111150 0 0 100 100 "Dialog A"
cannot be
;int i=100
;0 "" 0x124C0644 0x8111150 0 0 i i "Dialog A"


Otherwise I would say to pass a call through the WM_SIZE event that calls dialogs and sets the size based on the size of the parent dialog. But...I don't think it can be done that way. It has to have something to do with the WM_SIZE...I just don't know what yet!
#8
Finished...File added to original post.

It was (as it usually is) way simpler than I was trying to make it!

Thanks for your help,
Jimmy Vig
#9
Do you think that you could make it so that you could drag Dialog_1_TheVig off of the other dialogs making it its own dialog?
#10
Time_Runner Wrote:Do you think that you could make it so that you could drag Dialog_1_TheVig off of the other dialogs making it its own dialog?

I don't think so...right off I don't see the solution, but that doesn't mean that it won't come to me or someone else.
#11
I know that it can be done but how is the question!

int h1=win("Notepad")
SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 2|8
2
SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 1|8
#12
This is all I've got so far...Put it in the messages 2 section after sel wParam. It detaches after you click it off twice...don't know why yet. And then it lets you move it but not outside the parent dialog. I'll keep on working on it a little bit.

,case 4
,int h1=child("Dialog B" "#32770" win("Dialog" "#32770") 0x1)
,Acc a=acc("Attatched" "CHECKBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int state=a.State()
,out state
,if state=1048580
,,SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 1|8
,if state=1048596
,,SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 2|8
#13
I tried this in many ways and nothing happens but I will keep trying.
#14
Make sure you put that particular code in the dialog for B...otherwise I don't think it will work.

Function Dialog_1_TheVig
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3 4"


str e4
sel message
,case 0 ;;on WM_INITDIALOG of the parent dialog
,ret ShowDialog("" &Dialog_1_TheVig &controls wParam 1 WS_CHILD 0 0 0 200)
,case 1 ;;on OK of the parent dialog
,;hDlg=lParam
,;DT_GetControls hDlg &controls
,;out e4

;BEGIN DIALOG
;4 "" 0x10040644 0x0 0 0 100 100 "Dialog B"
;3 Static 0x54000000 0x0 2 2 48 12 "B"
;4 Button 0x54012003 0x0 2 16 48 12 "Attatched"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,str c4Att=1
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,int h1=child("Dialog B" "#32770" win("Dialog" "#32770") 0x1)
,Acc a=acc("Attatched" "CHECKBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int state=a.State()
,out state
,if state=1048580
,,SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 1|8
,if state=1048596
,,SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 2|8

ret 1
#15
I did not have

;4 Button 0x54012003 0x0 2 16 48 12 "Attatched"

Now I have something to work with
#16
Reverse states

,if state=1048596
,,SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 1|8
,if state=1048580
,,SetWinStyle h1 WS_CAPTION|WS_BORDER|WS_THICKFRAME 2|8
#17
Still can't pull it out of the parent...

Is there a way to actually destroy the window and recall the dialog? Well then if there was any information in there you would lose it...could back up and call.

I'm just not sure.
#18
I am sure that you will find this very useful however win dialog is in one state you can not call it. You will have to comment (/) it out but it does salve the problem.

Macro
Trigger AF2     Help - how to add the trigger to the macro
Code:
Copy      Help
mov 0 0 win("Forms")

mov 0 0 child("Forms" "MsoCommandBar" win("Document1 - Microsoft Word" "OpusApp") 0x1)

/mov 0 0 win("Forms")

/mov 0 0 child("Forms" "MsoCommandBar" win("Document1 - Microsoft Word" "OpusApp") 0x1)
#19
I'm just not seeing how this works...do you have an example?
#20
I will make you one
#21
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

So I decided to try it a different way (WS_CHILD 2|8) this pegged my CPU at 100 and I had to stop the program but it did do the trick.

My computer is only a 1600

I will keep trying

Added later
By the way everything I read says that you should not do it this way but I figured no pain no gain
#22
I was looking at the form toolbar in micro-word trying to get the mov code you sent, and it made me think "wow, dockable tool bars are totally rad! I would love to make stuff just like that in my programs." I talk to myself frequently.

So how's about jumping ship here and working out a new post for dialogs with dockable toolbars just like the ones in micro-word!

See you in the other post,
Jimmy Vig


Forum Jump:


Users browsing this thread: 2 Guest(s)