Home All Groups Group Topic Archive Search About
Author
31 Jan 2006 9:49 AM
guy
in an MDI app, how do i determine which MDI child contol currently has the
focus? (from the MDI form)

Author
31 Jan 2006 10:21 AM
CMM
Um, Me.ActiveMdiChild

? You really should have checked the help files or intellisense before
posting this.

Watch out for ActivateMdiChild (Activate vs Active)... AutoComplete might
have confused you.


Show quoteHide quote
"guy" <g**@discussions.microsoft.com> wrote in message
news:7FF938A1-F91C-40BE-AF0A-3DAFD549ECAB@microsoft.com...
> in an MDI app, how do i determine which MDI child contol currently has the
> focus? (from the MDI form)
Author
31 Jan 2006 10:39 AM
CMM
Or... to answer your question more specifically
Me.ActiveMdiChild.ActiveControl


Show quoteHide quote
"CMM" <cmm@nospam.com> wrote in message
news:e3eUgAlJGHA.1132@TK2MSFTNGP10.phx.gbl...
> Um, Me.ActiveMdiChild
>
> ? You really should have checked the help files or intellisense before
> posting this.
>
> Watch out for ActivateMdiChild (Activate vs Active)... AutoComplete might
> have confused you.
>
>
> "guy" <g**@discussions.microsoft.com> wrote in message
> news:7FF938A1-F91C-40BE-AF0A-3DAFD549ECAB@microsoft.com...
>> in an MDI app, how do i determine which MDI child contol currently has
>> the
>> focus? (from the MDI form)
>
>
Author
31 Jan 2006 12:49 PM
guy
wrong.
i spent quite a time looking at help, ActiveControl does ***not *** return
the control with the focus. if i have a user control with a number of text
boxes on a form for example it returns the user contriol ***not*** the text
box with focus

Show quoteHide quote
"CMM" wrote:

> Or... to answer your question more specifically
> Me.ActiveMdiChild.ActiveControl
>
>
> "CMM" <cmm@nospam.com> wrote in message
> news:e3eUgAlJGHA.1132@TK2MSFTNGP10.phx.gbl...
> > Um, Me.ActiveMdiChild
> >
> > ? You really should have checked the help files or intellisense before
> > posting this.
> >
> > Watch out for ActivateMdiChild (Activate vs Active)... AutoComplete might
> > have confused you.
> >
> >
> > "guy" <g**@discussions.microsoft.com> wrote in message
> > news:7FF938A1-F91C-40BE-AF0A-3DAFD549ECAB@microsoft.com...
> >> in an MDI app, how do i determine which MDI child contol currently has
> >> the
> >> focus? (from the MDI form)
> >
> >
>
>
>
Author
31 Jan 2006 6:34 PM
CMM
Ah yes... in which case you need to check the "type" of the active control
and then dive into it to find *its* active control.

For instance there are times if you do MDIParent.ActiveControl you actually
get a reference to one of the MDIChildren.... and you not to code for this
possibility.


Show quoteHide quote
"guy" <g**@discussions.microsoft.com> wrote in message
news:775C682F-3E97-4659-9E6A-77766F78E02D@microsoft.com...
> wrong.
> i spent quite a time looking at help, ActiveControl does ***not *** return
> the control with the focus. if i have a user control with a number of text
> boxes on a form for example it returns the user contriol ***not*** the
> text
> box with focus
>
> "CMM" wrote:
>
>> Or... to answer your question more specifically
>> Me.ActiveMdiChild.ActiveControl
>>
>>
>> "CMM" <cmm@nospam.com> wrote in message
>> news:e3eUgAlJGHA.1132@TK2MSFTNGP10.phx.gbl...
>> > Um, Me.ActiveMdiChild
>> >
>> > ? You really should have checked the help files or intellisense before
>> > posting this.
>> >
>> > Watch out for ActivateMdiChild (Activate vs Active)... AutoComplete
>> > might
>> > have confused you.
>> >
>> >
>> > "guy" <g**@discussions.microsoft.com> wrote in message
>> > news:7FF938A1-F91C-40BE-AF0A-3DAFD549ECAB@microsoft.com...
>> >> in an MDI app, how do i determine which MDI child contol currently has
>> >> the
>> >> focus? (from the MDI form)
>> >
>> >
>>
>>
>>
Author
31 Jan 2006 12:50 PM
guy
thanks for the sarcasm, i spent a lot of time doing just that with no success

Show quoteHide quote
"CMM" wrote:

> Um, Me.ActiveMdiChild
>
> ? You really should have checked the help files or intellisense before
> posting this.
>
> Watch out for ActivateMdiChild (Activate vs Active)... AutoComplete might
> have confused you.
>
>
> "guy" <g**@discussions.microsoft.com> wrote in message
> news:7FF938A1-F91C-40BE-AF0A-3DAFD549ECAB@microsoft.com...
> > in an MDI app, how do i determine which MDI child contol currently has the
> > focus? (from the MDI form)
>
>
>
Author
31 Jan 2006 10:45 AM
Cor Ligthert [MVP]
Guy,

If you do something from a MDI form than it has in my opinion the focus.

If it is from the MDIContainer than it can be something as

\\\
For Each frm As Form In Me.MdiChildren
            If frm.Focused Then
                MessageBox.Show(frm.Text)
            End If
Next
////
This kind of things you can do as well from a MDIChild by adding
\\\
For each frm as Form in Me.MDIParent.MDIChildren
///

I hope this helps

Cor
Author
31 Jan 2006 12:49 PM
guy
hi Cor, yes but which TextBox on frm has the focus? and what if the text box
is on a user control on another user control on the child form?

guy

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Guy,
>
> If you do something from a MDI form than it has in my opinion the focus.
>
> If it is from the MDIContainer than it can be something as
>
> \\\
> For Each frm As Form In Me.MdiChildren
>             If frm.Focused Then
>                 MessageBox.Show(frm.Text)
>             End If
> Next
> ////
> This kind of things you can do as well from a MDIChild by adding
> \\\
> For each frm as Form in Me.MDIParent.MDIChildren
> ///
>
> I hope this helps
>
> Cor
>
>
>
Author
31 Jan 2006 2:10 PM
Cor Ligthert [MVP]
Guy

I saw that I had still this sample that I once made to show recursive, I
have put it on our website, I thought that it was exactly what you where
asking for.

http://www.vb-tips.com/default.aspx?ID=8ff290d4-5c16-4cef-ba06-56e3599238c1

I hope this helps,

Cor
Author
31 Jan 2006 4:54 PM
guy
thanks cor:)

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Guy
>
> I saw that I had still this sample that I once made to show recursive, I
> have put it on our website, I thought that it was exactly what you where
> asking for.
>
> http://www.vb-tips.com/default.aspx?ID=8ff290d4-5c16-4cef-ba06-56e3599238c1
>
> I hope this helps,
>
> Cor
>
>
>