Results 1 to 13 of 13

Thread: MDI, MODAL, and Child forms *UNRESOLVED*

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    MDI, MODAL, and Child forms *UNRESOLVED*

    I am working on an MDI application and am running into a problem with the forms.

    now there is the one main MDI form.. and then there are child forms that are all the same (IE created via in instance of a premade form)
    VB Code:
    1. Dim frm as New frmMDIChild
    2. frm.show
    so the user can open multiple forms at once.

    so now my problem is this, on this child form there is a section where if you select yes to a yes/no option button, a pop up form comes up to be completed. Now this form needs to be modal to the MDI Child form and I am looking at the best way to accomplish this

    the only real problem is i can't use the MDI child form as the second parameter when using popupform.show vbModal, owner

    it wont let me do it.. and I need that so I can have the popup form show in the center of the MDI child form... any ideas? should I just get the location of the MDI Child form and move the popup form accordingly?
    Last edited by kleinma; Mar 10th, 2003 at 01:33 PM.

  2. #2

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    bump

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Why do you need the owner parameter? Can't you just show the popup form modally? You could use global variables, maybe in an array keyed to specific child forms, to store the completed popup form data if necessary.

  4. #4

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by salvelinus
    Why do you need the owner parameter? Can't you just show the popup form modally? You could use global variables, maybe in an array keyed to specific child forms, to store the completed popup form data if necessary.
    the reason i want to use the MDI Child as the owner of the modal form is because i wanted to open the modal form in the center of the owner... via its start up position property.. but if i can't use the MDI child as the owner... then I will have to find some other way to accomplish this

  5. #5
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Hmm, don't know, I try to avoid MDI forms. Can it be accessed through the parent form, e.g. parentform.childform1.etcetc?
    One trick used in eVB is to use multiple frames, the size of the display, on one form, only showing the relevant one at any one time. If your child forms did this, and your code prevented showing other forms/frames until the form was completely filled in, you could mimic a modal form.

  6. #6

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    well the app i am making is what MDI was made for.... it is a data entry app to enter applications... and the user may open multiple applications at once

  7. #7

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    still no luck with this

  8. #8
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Originally posted by kleinma
    still no luck with this
    I do not know whats the big deal in this.
    Can't you programmatically position the position of that form instead of having to use the parent form as a owner. ??? Where's the problem in that ?

  9. #9

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by techyspecy
    I do not know whats the big deal in this.
    Can't you programmatically position the position of that form instead of having to use the parent form as a owner. ??? Where's the problem in that ?
    thats what i am working on now

  10. #10
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    Due to serious limitations in VB's MDI interface that cannot be done without some serious subclassing stuff, perhaps a User Control (and don't expect this to be easy), or generate a "regular" modal window otherwise.
    McGenius

  11. #11

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    well using this code i did up... it pretty much does what i need it to do... so i think ill be ok with this

    I call it in the form load event of any of the forms that pop up off the MDI children forms
    VB Code:
    1. Public Sub CenterPopup(Owner As Form, Popup As Form)
    2.     On Error GoTo EH:
    3.         Dim iTop As Integer
    4.         Dim iLeft As Integer
    5.         iTop = Owner.Top + ((Owner.Height / 2) - (Popup.Height / 2))
    6.         iLeft = Owner.Left + ((Owner.Width / 2) - (Popup.Width / 2))
    7.         Popup.Move iLeft, iTop
    8.        
    9. EH:
    10. End Sub

  12. #12
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    Perhaps, I misread you requirements. If it does what you expect then it's excelent.
    McGenius

  13. #13

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by McGenius
    Perhaps, I misread you requirements. If it does what you expect then it's excelent.
    yeah it does the job...

    my ultimate goal was to have a modal form be owned by an mdi child, but since by design that is impossible, i show it modal with no owner and center it on top of the mdi child, the only reason i wanted the mdi child to be the owner was for placement of the popup modal form...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width