How to make MODAL MDIChild

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Petchey

    How to make MODAL MDIChild

    My App is an MDI Parent with MDI Child forms.

    One of the child forms calls a modal dialog form.

    I would like the modal dialog form to be INSIDE the mdi parent window.

    I am not bothered about any of the other things associated with MDI
    Parent/Child relationships, this is purely an appearance issue.

    MDIParent property and ShowDialog seem to be mutually exclusive.

    Surely some bright sparks knows how this is achieved.


    --
    Chris Petchey
  • ng

    #2
    Re: How to make MODAL MDIChild

    The best I can offer is to set the modal form's owner property to the
    mdiparent, then call showdialog. It won't be truly an mdichild, but at
    least it will be connected to the mdiparent.

    T


    Chris Petchey wrote:
    [color=blue]
    > My App is an MDI Parent with MDI Child forms.
    >
    > One of the child forms calls a modal dialog form.
    >
    > I would like the modal dialog form to be INSIDE the mdi parent window.
    >
    > I am not bothered about any of the other things associated with MDI
    > Parent/Child relationships, this is purely an appearance issue.
    >
    > MDIParent property and ShowDialog seem to be mutually exclusive.
    >
    > Surely some bright sparks knows how this is achieved.
    >
    >[/color]

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: How to make MODAL MDIChild

      Chris,

      Some people give a solution and than that solution is not to do, and you get
      very few answers.

      Others ask help for a problem.

      Can it be that your problem is that when the mdi form is showed that it
      might give only control to another form or whatever as some conditions are
      fulfilled.

      That is easy to do by setting in the closing event of that form
      \\\
      if something not is done then
      e.cancel = true 'or false because I am always confused by that just try
      that
      end if
      ///

      I hope this helps,

      Cor


      Comment

      • Chris Petchey

        #4
        Re: How to make MODAL MDIChild

        If I understand your suggestion:

        Dim f As New Form2
        f.Owner = Me.MdiParent
        f.ShowDialog()

        It appears to me that the second line makes NO DIFFERENCE AT ALL.
        In what way is it "connected to the mdiparent" ?
        It is not visibly contained within the mdiparent window, a specific
        requirement of my original post.
        Please clarify


        In message <RgQMe.23332$XM 3.1963@bignews5 .bellsouth.net> , ng
        <t_again@yahoo. com> writes[color=blue]
        >The best I can offer is to set the modal form's owner property to the
        >mdiparent, then call showdialog. It won't be truly an mdichild, but at
        >least it will be connected to the mdiparent.
        >
        >T
        >
        >
        >Chris Petchey wrote:
        >[color=green]
        >> My App is an MDI Parent with MDI Child forms.
        >>
        >> One of the child forms calls a modal dialog form.
        >>
        >> I would like the modal dialog form to be INSIDE the mdi parent window.
        >>
        >> I am not bothered about any of the other things associated with MDI
        >>Parent/Child relationships, this is purely an appearance issue.
        >>
        >> MDIParent property and ShowDialog seem to be mutually exclusive.
        >>
        >> Surely some bright sparks knows how this is achieved.
        >>
        >>[/color][/color]

        --
        Chris Petchey

        Comment

        • Chris Petchey

          #5
          Re: How to make MODAL MDIChild

          Cor,

          I was quite specific about what I was attempting to do.
          To reiterate:
          I want my modal dialog to be "contained" in my mdiwindow. The modal
          dialog does not need to be a true mdichild, but must give the appearance
          of being contained within the mdiwindow.

          I am unsure what your solution represents. It seems you have answered a
          question other than the question I asked, and maintained the mysticism
          of the redirection by enveloping it in a web of english is not my first
          language.

          As I am no closer to my solution, i guess it didnt help.

          However, are you aware that google groups attributes 10,200 articles to
          "you" in this news group alone (search on "Cor Ligthert")?

          Chris

          In message <u2MW018oFHA.14 44@TK2MSFTNGP10 .phx.gbl>, "Cor Ligthert [MVP]"
          <notmyfirstname @planet.nl> writes[color=blue]
          >Chris,
          >
          >Some people give a solution and than that solution is not to do, and you get
          >very few answers.
          >
          >Others ask help for a problem.
          >
          >Can it be that your problem is that when the mdi form is showed that it
          >might give only control to another form or whatever as some conditions are
          >fulfilled.
          >
          >That is easy to do by setting in the closing event of that form
          >\\\
          >if something not is done then
          > e.cancel = true 'or false because I am always confused by that just try
          >that
          >end if
          >///
          >
          >I hope this helps,
          >
          >Cor
          >
          >[/color]

          --
          Chris Petchey

          Comment

          • Cor Ligthert [MVP]

            #6
            Re: How to make MODAL MDIChild

            Chris,
            [color=blue]
            >
            > I was quite specific about what I was attempting to do.[/color]

            I doubt that because you did beside mine only get an answer how to handle a
            showdialog.
            [color=blue]
            > To reiterate:
            > I want my modal dialog to be "contained" in my mdiwindow.[/color]

            And therefore I gave an answer, just open it as a normal mdiform, however
            prevent that the user can leave that the same as with a dialog form by
            setting in the closing event of that mdi form.

            If conditionIsNotF ulfilled then 'which is the same as with a ShowDialog
            e.cancel = true 'or as I wrote false just test that
            end if

            And than of course if you use a button on the mdi child in the event of
            that.
            condition set
            me.close

            I hope this helps,

            Cor


            Comment

            • Chris Petchey

              #7
              Re: How to make MODAL MDIChild

              Cor

              Your solution prevents the user from closing the mdichild.

              MODAL means that the user can't interact with any other form in the
              application until the modal form closes.

              How much more specific can I be? I want a modal form that cannot be
              moved outside an mdiwindow. Access exhibits this behaviour.

              Please attempt to understand my problem, rather than a different problem
              that you know the answer to. It doesnt help. If you don't know, you
              don't know.

              Have a nice weekend

              Chris



              In message <ujkbvuLpFHA.32 0@TK2MSFTNGP09. phx.gbl>, "Cor Ligthert [MVP]"
              <notmyfirstname @planet.nl> writes[color=blue]
              >Chris,
              >[color=green]
              >>
              >> I was quite specific about what I was attempting to do.[/color]
              >
              >I doubt that because you did beside mine only get an answer how to handle a
              >showdialog.
              >[color=green]
              >> To reiterate:
              >> I want my modal dialog to be "contained" in my mdiwindow.[/color]
              >
              >And therefore I gave an answer, just open it as a normal mdiform, however
              >prevent that the user can leave that the same as with a dialog form by
              >setting in the closing event of that mdi form.
              >
              >If conditionIsNotF ulfilled then 'which is the same as with a ShowDialog
              > e.cancel = true 'or as I wrote false just test that
              >end if
              >
              >And than of course if you use a button on the mdi child in the event of
              >that.
              >condition set
              >me.close
              >
              >I hope this helps,
              >
              >Cor
              >
              >[/color]

              --
              Chris Petchey

              Comment

              • Cor Ligthert [MVP]

                #8
                Re: How to make MODAL MDIChild

                Chris,

                You are right, I did not test it, I will try a solution tomorrow, based on
                this.

                It will be based on the fact that every form will when it get focus check
                (using a shared class) if the form that we call modal. is open and than give
                the focus back to that. AFAIK is a modal form nothing more than an advanced
                dialog, and therefore unusable for this.

                However I promised to somebody else to test something first and that is
                primaley, maybe this sentence above gives you self the idea.

                Cor


                Comment

                • Cor Ligthert [MVP]

                  #9
                  Re: How to make MODAL MDIChild

                  Chris

                  As promished. It is just a simple approach meant how it could be possible.

                  \\\The "Modal" child
                  Private Sub Form2_LostFocus (ByVal sender As Object, _
                  ByVal e As System.EventArg s) Handles MyBase.LostFocu s
                  If Me.TextBox1.Tex t <> "1" Then
                  Me.Focus()
                  Else
                  Me.Close()
                  End If
                  End Sub
                  ///
                  \\\All forms except the parent (you can by instance inherit a form)
                  Private Sub Form3_Activated (ByVal _
                  sender As Object, ByVal e As System.EventArg s) _
                  Handles MyBase.Activate d
                  test.test(Me.Md iParent)
                  End Sub
                  End Class
                  ///
                  \\\
                  Public Class test
                  Public Shared Sub test(ByVal par As Form)
                  For Each frm As Form In par.MdiChildren
                  If frm.Name = "Form2" Then
                  If DirectCast(frm, Form2).TextBox1 .Text <> "1" Then
                  frm.Focus()
                  End If
                  Exit For
                  End If
                  Next
                  End Sub
                  ///

                  I hope this helps,

                  Cor


                  Comment

                  • Dan Wagner

                    #10
                    Re: How to make MODAL MDIChild

                    Chris,

                    I too am looking for a way to make an MDI child a modal dialogue (I have
                    the same desires as you; it merely needs to be contained by the bounds
                    of the MDI parent). If you ever get this figured out, I'd love to be
                    copied on the response.

                    I also appreciate your subtlety when explaining that you have no idea
                    how to read some of the responses to your post.

                    *** Sent via Developersdex http://www.developersdex.com ***

                    Comment

                    • Nicolas Noakes

                      #11
                      Re: How to make MODAL MDIChild

                      Chris / Dan

                      Why not approach the problem from a different angle? Open a normal
                      (forget mdi) form as a modal dialog, and set its top and left position
                      at runtime relative to the mdi parent form? You get to keep all the
                      built in modal and dialog features, and it's not that much effort to
                      acheive your visual requirement.

                      Nicolas


                      *** Sent via Developersdex http://www.developersdex.com ***

                      Comment

                      Working...