Click to See Complete Forum and Search --> : Modal Mdi-child
onerrorgoto
Nov 18th, 1999, 04:01 PM
Hello World :)
I need to make one of my mdi-child forms stay modal. I need the user to fill in some info before going any further.
I have searched this forum but havn't found an answer to this question.( maybe bad search :( )
I have tried to make it stay "allways on top" but that doesn't work either.
any suggestions.
------------------
On Error Goto Bed :0)
anders@zsystemdesign.se
[This message has been edited by onerrorgoto (edited 11-19-1999).]
Serge
Nov 18th, 1999, 06:44 PM
Form Ontop does work. Copy this to your MDI form's General Declaration:
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Public Sub MakeOnTop(hWnd As Long)
Dim lRet As Long
lRet = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
End Sub
Then when you want to show your Child form use this:
Load frmChild
MakeOnTop frmChild.hWnd
frmChild.Show
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
onerrorgoto
Nov 18th, 1999, 08:44 PM
Thank you Serge
Just a few more questions for clarity.
Which general declaration? Mdi-parents, "modal" Mdi-child's or Mdi-child that shows the "modal" Mdi-child.
I have tried putting your code in all three places and it only works when I put it in the calling mdi-child(halfway :( ).
I dont get any errors when I call my "modal form, but when I click on the form in the background my "modal" form disaperes. It is placed behind the form I clicked on.
I don't know if it makes any differens that I'm calling my "modal" form from another Mdi-child and not from the Mdi-parent.
------------------
On Error Goto Bed :0)
anders@zsystemdesign.se
[This message has been edited by onerrorgoto (edited 11-19-1999).]
Serge
Nov 18th, 1999, 08:50 PM
If you call your Child forms from an MDI form then use MDI form.
You can have only one (1) MDI form in your project, so I suggest that you put that in General Declaration of an MDI form (the only MDI form in your project)
If you call your Child forms from some other places, then you can put that in a module (.BAS)
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
onerrorgoto
Nov 18th, 1999, 09:24 PM
Well I only have one MDI-form(MDIParent) and two MDI-child forms(MDIChild1 and MDIChild2).
When I click a commandbutton on MDIChild1 I want to put MDIChild2 "allways on top".
(MDIChild2 is half the size of MDIChild1.)
So I put your code in a modul.
And my MDIChild2 shows as I call it. But when I click anywhere on MDIChild1, MDIChild2 is placed behind MDIChild1 :( (Bad child)
------------------
On Error Goto Bed :0)
anders@zsystemdesign.se
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.