PC Review


Reply
Thread Tools Rate Thread

Bringing second form to front when first gets focus (keeping both windows on top)

 
 
papalarge
Guest
Posts: n/a
 
      5th Feb 2007
I have a VB.NET application that consists of a toolbar and a subwindow
that I want to function together and not independently. So when I
give focus to one, I want to make sure that the other is visible on
the screen (brought to front, right behind the one in focus).

I've played with the activated event of each form, but everything I've
tried so far fails, as it's a pretty cyclical process that gets
initiated. I'd love any help... here's what I have so far that
doesn't work... heh.

-----------------------
'PUBLIC
Dim bIgnoreActivation as Boolean = False
-----------------------
'SUB-WINDOW

Private Sub frmSubWindow_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated

'IF THIS WAS THE ORIGINAL WINDOW GIVEN FOCUS
If Not bIgnoreActivation Then
'SET OUR IGNORE FLAG SO THE OTHER WINDOW
'KNOWS IT WASN'T ORIGINALLY CALLED
bIgnoreActivation = True
frmToolbar.BringToFront()
End If

Me.BringToFront()

'SET THE FLAG BACK
bIgnoreActivation = False

End Sub

------------------------
'TOOLBAR

Private Sub frmToolbar_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated

'IF THIS WAS THE ORIGINAL WINDOW GIVEN FOCUS
If Not bIgnoreActivation Then
'SET OUR IGNORE FLAG SO THE OTHER WINDOW
'KNOWS IT WASN'T ORIGINALLY CALLED
bIgnoreActivation = True
frmSubWindow.BringToFront()
End If

Me.BringToFront()

'SET THE FLAG BACK
bIgnoreActivation = False
End Sub

 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      6th Feb 2007
"papalarge" <(E-Mail Removed)> schrieb
> I have a VB.NET application that consists of a toolbar and a
> subwindow


I guess this means a toolbar /window/ and a sub window. Otherwise it sounds
like a free floating toolbar and a sub window of that toolbar.

Have you tried passing the toolbar window as the owner of the sub window?
In toolbar window:
dim t as new subwindow
t.show(me)

It does have influence on the focus, like the sub window automatically being
minimized whenever you minimize the toolbar window (IIRC), but I don't know
if it also has the effect you're looking for.


Armin

 
Reply With Quote
 
papalarge
Guest
Posts: n/a
 
      28th Feb 2007
Yeah, toolbar + subwindow is right...

What's the inherited baseclass of subwindow? Can't find that in
VB.NET....




On Feb 6, 2:12 am, "Armin Zingler" <az.nos...@freenet.de> wrote:
> "papalarge" <kwy...@gmail.com> schrieb
>
> > I have a VB.NET application that consists of a toolbar and a
> > subwindow

>
> I guess this means a toolbar /window/ and a sub window. Otherwise it sounds
> like a free floating toolbar and a sub window of that toolbar.
>
> Have you tried passing the toolbar window as the owner of the sub window?
> In toolbar window:
> dim t as new subwindow
> t.show(me)
>
> It does have influence on the focus, like the sub window automatically being
> minimized whenever you minimize the toolbar window (IIRC), but I don't know
> if it also has the effect you're looking for.
>
> Armin



 
Reply With Quote
 
papalarge
Guest
Posts: n/a
 
      28th Feb 2007
Didn't understand you at first, but just got it working a second ago.
On form load, set the subwindows owner to the toolbar, which allowed
them coincide when they receive focus.

Thanks Armin!


On Feb 6, 2:12 am, "Armin Zingler" <az.nos...@freenet.de> wrote:
> "papalarge" <kwy...@gmail.com> schrieb
>
> > I have a VB.NET application that consists of a toolbar and a
> > subwindow

>
> I guess this means a toolbar /window/ and a sub window. Otherwise it sounds
> like a free floating toolbar and a sub window of that toolbar.
>
> Have you tried passing the toolbar window as the owner of the sub window?
> In toolbar window:
> dim t as new subwindow
> t.show(me)
>
> It does have influence on the focus, like the sub window automatically being
> minimized whenever you minimize the toolbar window (IIRC), but I don't know
> if it also has the effect you're looking for.
>
> Armin



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bringing the last field in form to front in datasheet view =?Utf-8?B?TWFkaHVyaQ==?= Microsoft Access Form Coding 4 15th Jul 2005 11:08 AM
Bringing a child form to the front Richard L Rosenheim Microsoft VB .NET 3 28th Oct 2004 05:05 PM
Bringing a form to focus Muscha Microsoft Dot NET Framework Forms 2 28th Nov 2003 02:35 AM
Bringing Form to Top/Front Kevin Carter Microsoft C# .NET 1 30th Oct 2003 11:30 AM
bringing form to Top/Front Kevin Carter Microsoft VB .NET 4 29th Oct 2003 11:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:20 PM.