InfoBox and focus on the form


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Fabian,

Try this just to see if it works.  Use a timer to re-execute the activation of the form.  The problem could be that all of this is trying to execute on the same thread and so the re-activation never takes place.  Also, this is not an issue with SF, it has 100% to do with the way WinForms works.

InfoBox()
'-- You can reduce this to a smaller interval, but starting with 1 second will give you a good visual when  it executes.
MyTimer.Interval = 1000
MyTimer.Enabled = True

Timer Code
MyTimer.Enabled = False

'-- You might try just forcing the focus back to the control itself first.  You could then try
'   All of the other options previously mentioned in this thread if it doesn't work.
MyControlToFocus.Focus()

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Thanks!!! It worked ok you got the solution, I not suppose that a timer can change the things, but you clarify me it. BigGrin

Dim InfoboxTimer As New Timer()
InfoboxTimer.Interval = 50 'the min value that work ok for me...
AddHandler InfoboxTimer.Tick, AddressOf InfoboxTimer_Tick
InfoboxTimer.Enabled = True
MicroFour.StrataFrame.Messaging.InfoBox.DefaultTimeOut = 1000
MicroFour.StrataFrame.Messaging.InfoBox.NotifyBox("Title","description")

'Timer_Tick  handler
Private Sub InfoboxTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
      Dim Tmr As Timer = CType(sender, Timer)
      Tmr.Enabled = False
      Me.ParentForm.Activate() 'I coding on a user control... activate his form
      'Me.txtCodigo.Focus()
End Sub


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Good.  I am glad that worked for you.  At some point all developers have the "Window Handle Blues." Hehe
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search