P
papalarge
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
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