I'm facing a problem to embed dialog into another dialog.
Reason to do is i have a bunch of dialog to show but i don't want user to see it as dialog.
I have created a Main dialogbox and want to embed the dialog into this main dialog.
Can someone tell me how?
I have search the internet. Actually if i able to set the "screentoclient()" i think the problem should able to solve.
But when i search the "screentoclient", the solution that i found was use to capture the mouse position.
I want the set the screen to client screen.
How can i do it?
I can't really tell what you are asking. What do you mean by embded a dialog in a dialog? You can show another dialog box from your dialog box, you can change the dialog within the dialog box you can not physically embed another dialog form within a dialog form and even if you could I can see no use for such a thing.
Yes, you have to be more specific and detailed to explain what you want.
What is the dialogbox you have created? Is it a Form? You can create another dialog at any time form the first form, like it was embedded. If the second dialog is a form too, you would show it like formDialog2.Show vbModal, Me (showing it from Form1 for instance, where the Me makes the form from where you show the dialog the owner form.
Sorry that i did not explain my problem clearly.
Attached is the structure of what i'm try to do.
Hope that with my drawing, it able to express what i'm try to say.
I know that there are few steps needed.
That is to get the "screentoclient" and move the dialog to the CRect position.
I not able to "screentoclient" my form so i not able to proceed with my project.
Hope you guys can help.
Thanks.
You still have not told us what you are doing. The only way you can put a form inside a form is if the parent is a MDI Parent form and the one you want to put inside is a MID Child but then you can not use a MDI child as a modal dialog form.
You can show a form on top of a form and center it over the form which calls it. If you also set it modal then it will stay on top of the other form until the modal condition is released. You can also use frames on your form instead of forms and toggle the visible property of each form as needed which is the closest thing you will find to a form in a form.
All of that said you have not even told us if you are working on a pc app or a web based app and you have shown no code. And your "screentoclient" really has no meaning you'll have to better define what you are doing and/or what you are trying to do before we could be of much help to you.
I developing a dialog base application.
one Main dialog and few child dialog.
I'm not creating a MDI application.
Code:
Private Sub Form_Load()
frmInfo.Show vbModaless, Me
Call MoveWindow(frmInfo.hwnd, Frame1.Left, Frame1.Top, frmInfo.Width, frmInfo.Height, False)
End Sub
i'm tyring to put a frameless dialog to show on top of my main dialog.
The problem is the frmInfo cannot show at the position that i want.
thanks
What position are you trying to attain?
What result are you getting?
Edit to add:
If you are simply trying to position the top left corner of the new form over the top left corner of the frame on your existing form then you could do it easy with a little math.
No need to call the move window function though that would work with the right parameters. You can use the form properties to get what you want.
keep in mind that if you are showing this non modal that the user will be able to click on the initial form and your form will dissappear behind it. In general not a good idea for dialogs.
Of course not, they are not joined together. You would have to write code that moves it if that is what you want to do. I still do not understand what you are doing though. Seems to me that using frames on Form1 which toggle on/off would be better suited for dialogs. Or even just one form with or without any frames which is coded to display different messages and if needed buttons do different actions depending on which dialog is shown.
Trying to make a form over a form and trying to make them move together as one doesn't make a lot of sense especially so if the smaller form is non modal as the moment you try to move the form behind would make the smaller form dissappear behind it and no longer have access to it. I can see a user doing this by accident very easy and often.
Seems like a very poor design to me, perhaps you should rethink this approach.
Nevertheless, to move the forms together with the main form you simply have to put the positioning code into the Form_Resise() event of Form1.
And to make the subform stay on top of Form1 you'd have to make use of the SetWindowPos() API.
Unfortunately if you use that set window API then the form stays on top not only of your app but all other apps as well. I would be uninstalling the software right away
Well, the SetWindowPos() API allows the passing of a hWnd on top of which the secondary form should be placed.
Using the HWND_TOPMOST constant will put it on top af all other windows.
Passing the Form.hWnd instead will put it on top of that one, only.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.