﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » InfoBox and focus on the form</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 26 Sep 2026 03:58:09 GMT</lastBuildDate><ttl>20</ttl><item><title>InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12354.aspx</link><description>I like to display a InfoBox, but I want to keep the focus on the active control. How I can do that? I don't find a property on the infobox that says "getFocus" or something else, thanks :)</description><pubDate>Wed, 07 Nov 2007 17:50:10 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12547.aspx</link><description>Good.&amp;nbsp; I am glad that worked for you.&amp;nbsp; At some point all developers have the "Window Handle Blues." :hehe:</description><pubDate>Wed, 07 Nov 2007 17:50:10 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12535.aspx</link><description>&lt;FONT color=#111199&gt;&lt;STRONG&gt;Thanks!!!&amp;nbsp;It worked ok you got the solution, I not suppose that a timer can change the things, but you clarify me it. :D&lt;/STRONG&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoboxTimer&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Timer&lt;/FONT&gt;&lt;FONT size=2&gt;()&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoboxTimer&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Interval&lt;/FONT&gt;&lt;FONT size=2&gt; = 50 &lt;FONT color=#11bb11&gt;'the min value that work ok for me...&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AddHandler&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoboxTimer&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Tick&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AddressOf&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoboxTimer_Tick&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoboxTimer&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Enabled&lt;/FONT&gt;&lt;FONT size=2&gt; = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;True&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;MicroFour&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;StrataFrame&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Messaging&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoBox&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;DefaultTimeOut&lt;/FONT&gt;&lt;FONT size=2&gt; = 1000&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;MicroFour&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;StrataFrame&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Messaging&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoBox&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;NotifyBox&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Title","&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;description"&lt;/FONT&gt;&lt;FONT size=2&gt;) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;'Timer_Tick&amp;nbsp; handler&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;InfoboxTimer_Tick&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;sender&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Object&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;e&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;EventArgs&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Tmr&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Timer&lt;/FONT&gt;&lt;FONT size=2&gt; = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;CType&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;sender&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Timer&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tmr&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Enabled&lt;/FONT&gt;&lt;FONT size=2&gt; = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;ParentForm&lt;/FONT&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#010001 size=2&gt;Activate&lt;/FONT&gt;&lt;FONT size=2&gt;() &lt;FONT color=#11bb11&gt;'I coding on a user control... activate his form&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Me.txtCodigo.Focus()&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Wed, 07 Nov 2007 12:36:48 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12524.aspx</link><description>Fabian,&lt;/P&gt;&lt;P&gt;Try this just to see if it works.&amp;nbsp; Use a timer to re-execute the activation of the form.&amp;nbsp; The problem could be that all of this is trying to execute on the same thread and so the re-activation never takes place.&amp;nbsp; Also, this is not an issue with SF, it has 100% to do with the way WinForms works.&lt;/P&gt;&lt;P&gt;InfoBox()&lt;BR&gt;'-- You can reduce this to a smaller interval, but starting with 1 second will give you a good visual when&amp;nbsp; it executes.&lt;BR&gt;MyTimer.Interval = 1000 &lt;BR&gt;MyTimer.Enabled = True&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Timer Code&lt;/STRONG&gt;&lt;BR&gt;MyTimer.Enabled = False&lt;BR&gt;&lt;BR&gt;'-- You might try just forcing the focus back to the control itself first.&amp;nbsp; You could then try&lt;BR&gt;'&amp;nbsp;&amp;nbsp; All of the other options previously mentioned in this thread if it doesn't work.&lt;BR&gt;MyControlToFocus.Focus()</description><pubDate>Wed, 07 Nov 2007 09:43:39 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12513.aspx</link><description>Well, I'm sorry, but I'm all out of ideas on trying to get the form to re-activate.&amp;nbsp;</description><pubDate>Wed, 07 Nov 2007 09:09:37 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12495.aspx</link><description>Thanks for the reply&lt;/P&gt;&lt;P&gt;I try with you suggestions (Activate, SetActiveWindow, Focus, DoEvent) but I cannot make the form got focus while the infobox is showing (except with a mouse click on the form)... &lt;/P&gt;&lt;P&gt;If I can't make it work, I will edit the infobox source to accept a parameter with the calling form to see if I can call form.activate() or form.focus() from there and see if it get the order&lt;/P&gt;&lt;P&gt;Thanks for the&amp;nbsp;support, I known I'm try to make the stuff from another way that the&amp;nbsp;framework works and it give me troubles, but I have to make the try because&amp;nbsp;my boss have his needs to adapt from his FoxPro DOS App. and I are the only programmer and I convinced him to use .NET &amp;amp; SF :)</description><pubDate>Tue, 06 Nov 2007 10:14:58 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12473.aspx</link><description>You might try this from within the form:&lt;/P&gt;&lt;P&gt;InfoBox.NofityBox(...)&lt;BR&gt;Me.Activate()&lt;BR&gt;Me.textBox.Focus()&lt;/P&gt;&lt;P&gt;You might even need to make a call to System.Windows.Forms.Application.DoEvents().&amp;nbsp; What it does is force all of the Windows messages that are caught up on the message pump to push through, so even if the UI thread is busy, it will pause there and process the activate and focus calls.&amp;nbsp; It's worth a try.&lt;/P&gt;&lt;P&gt;A word of warning, though... always be careful with the call to DoEvents().&amp;nbsp; It can get you into trouble more often than not.&amp;nbsp; Just Google it and I'm sure you'll find some articles telling you how horrible it is.</description><pubDate>Tue, 06 Nov 2007 09:00:30 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12451.aspx</link><description>Thanks for reply.&lt;br&gt;
&lt;br&gt;
[codesnippet]Dim HWmdActiveWindow As Integer = GetActiveWindow()&lt;br&gt;
                    MicroFour.StrataFrame.Messaging.InfoBox.NotifyBox("Notificación", "No se encontró el registro tipeado") ', Me.ParentForm&lt;br&gt;
                    SetActiveWindow(HWmdActiveWindow)&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
I try from a usercontrol.textbox_keypress with me.parentform.Focus() and SetActiveWindow(me.parentform.handle) and no luck, the infoBox get the focus again &lt;br&gt;
&lt;br&gt;
I try to use system.threading.thread.sleep with some variants and nothing...&lt;br&gt;
&lt;br&gt;
to gain form focus I see that only works when I call the infobox and click on the form, It get focus and don't loose it again.&lt;br&gt;
&lt;br&gt;
Any idea? thanks!&lt;br&gt;</description><pubDate>Mon, 05 Nov 2007 12:08:19 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12413.aspx</link><description>The problem you are running into is the basic window handle issue that comes up from time to time when using WinForms.&lt;/P&gt;&lt;P&gt;The InfoBox is a window, which will take the focus away from the calling form.&amp;nbsp; However, you CAN set the focus back to your main for that called the InfoBox.&lt;/P&gt;&lt;P&gt;[codesnippet]InfoxBox.NotifyBox(...)&lt;BR&gt;Me.Focus()[/codesnippet]&lt;/P&gt;&lt;P&gt;If this doesn't work, then you can go a step further by using the WinAPI methods such as the SetActiveWindow:&lt;/P&gt;&lt;P&gt;[codesnippet]SetActiveWindow(Me.Handle)[/codesnippet]&lt;/P&gt;&lt;P&gt;Ultimately you will just have to make a call to refocus your main window rather than the InfoBox.&lt;/P&gt;&lt;P&gt;Finally, you may experience different behavior depending upon whether or not the InfoBox parent is the screen or the form.&amp;nbsp; This is a parameter that can be provided when showing an InfoBox (it is the Parent parameter).&amp;nbsp; If you set it to Nothing, then the InfoBox will show in the screen.&amp;nbsp; Otherwise it will appear within the control or form that you specify.&amp;nbsp; This may have an effect on getting the focus back as well, just FYI.</description><pubDate>Mon, 05 Nov 2007 09:02:06 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12407.aspx</link><description>[quote][b]Peter Jones (11/02/2007)[/b][hr]Hi Fabian,&lt;BR&gt;Sorry for the misunderstanding. I've never used the InfoBox control so I'm not speaking from experience but, from the SF Help,&amp;nbsp;I see that it has these propeties:&lt;BR&gt;&lt;BR&gt;.CanFocus - you could set this to false so it never receives focus.&lt;BR&gt;.GotFocus - you could trap the focus event and return focus to your text box.&lt;P&gt;Cheers, Peter[/quote]&lt;P&gt;Thanks for reply&lt;P&gt;.CanFocus is readonly :( and I try to trap gotfocus with an eventhandler, but the infobox is a static class and I guess that cannot trap it&lt;P&gt;I not sure what more I can try :/ thanks</description><pubDate>Mon, 05 Nov 2007 08:22:34 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12378.aspx</link><description>Hi Fabian,&lt;/P&gt;&lt;P&gt;Sorry for the misunderstanding. I've never used the InfoBox control so I'm not speaking from experience but, from the SF Help,&amp;nbsp;I see that it has these propeties:&lt;/P&gt;&lt;P&gt;.CanFocus - you could set this to false so it never receives focus.&lt;/P&gt;&lt;P&gt;.GotFocus - you could trap the focus event and return focus to your text box.&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Fri, 02 Nov 2007 19:01:42 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12370.aspx</link><description>Hello, thanks for reply, my english is bad and I not make good questions :w00t:&lt;/P&gt;&lt;P&gt;I try to avoid the infobox to give focus, I try to validate a textbox and show an infobox that say something, but while the infobox is displaying I like to mantain the focus on the textbox, it is posible? I try with mytextbox.focus before calling the infobox without sucess, but when I call the infobox, if I press faster click on the textbox, it get focus.&lt;/P&gt;&lt;P&gt;I think that if I pause some millisecons and focus on textbox it can have focus but I think that's not a good idea :/&lt;/P&gt;&lt;P&gt;Thanks :)</description><pubDate>Fri, 02 Nov 2007 11:45:05 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: InfoBox and focus on the form</title><link>http://forum.strataframe.net/FindPost12361.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;I think InfoBox.focus is what you want.&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Thu, 01 Nov 2007 21:17:30 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>