[Mono-winforms-list] FW: [MonoDevelop] Moving Focus Between Form

Valentin Sawadski valentin.sawadski at gmx.de
Thu Sep 20 13:19:11 EDT 2007


Hello,

On Thu, 2007-09-20 at 11:06 -0500, Tri_Nguyen at Dell.com wrote:
> The message I got from mono debug console is "Unknown - Fatal IO error
> 104 (Connection reset by peer) on X server :0.0.
> 
> Any help will be appreciated.

Uff, I'm sorry I've got absolutely no idea at all.
Better send a short message with a repro (if possible) or at least a
detailed error message to the winforms mailing list at
mono-winforms-list at lists.ximian.com and hope that someone there might
have a clue.

Kind Regards,
Valentin

> 
> Thanks.
> 
> -Tri.
> 
> -----Original Message-----
> From: Valentin Sawadski [mailto:valentin.sawadski at gmx.de] 
> Sent: Thursday, September 20, 2007 11:04 AM
> To: Nguyen, Tri
> Cc: mono-winforms-list at lists.ximian.com
> Subject: RE: FW: [MonoDevelop] Moving Focus Between Form
> 
> Hello Tri,
> 
> On Wed, 2007-09-19 at 16:11 -0500, Tri_Nguyen at Dell.com wrote:
> > Thanks Valentin, you are my hero.  It worked.  However, I hope you do
> not mind that I ask another question.  I have this routine, and every
> time I started in "mono" it terminate abruptly.  
> 
> I fear I have to say that I've got absolutely no clue what could be the
> cause for the crash.
> 
> Could you provide some more information about what went wrong (e.g. a
> stack trace or some console output)
> 
> Other than that I can only advise you to cc all your messages to the
> Winforms list on mono to address a broader audience, so that someone who
> actually has got an idea could also respond to your mails.
> 
> Kind Regards,
> Valentin
> 
> > 
> >         private void TextFonts()
> >         {
> >             string sFuncName = "TextFonts";
> > #if !_MONO
> >             Control.CheckForIllegalCrossThreadCalls = false;
> > #endif
> >             //this.WindowState = FormWindowState.Maximized;
> >             rCA = this.ClientRectangle;
> >             iArea = rCA.Width * rCA.Height;
> >             float font;
> >             // Create a Graphics object and set its
> >             // background as the form's background
> >             Graphics g = this.CreateGraphics();
> >             g.Clear(this.BackColor);
> >             SolidBrush blueBrush = new
> SolidBrush(Color.FromName(sColor[random.Next(0, 139)]));
> >             Font tnrFont = null;
> > 
> >             for (float i = 1; i <= 1000; i += 1)
> >             {
> >                 if (bKenny)
> >                 {
> >                     bKenny = false;
> >                     break;
> >                 }
> > 
> >                 try
> >                 {
> >                     rCA = this.ClientRectangle;
> >                     iArea = rCA.Width * rCA.Height;
> >                     g = this.CreateGraphics();
> >                     font = random.Next(1, 1000) * 10;
> >                     // Create font and brushes
> >                     tnrFont = new Font("Times New Roman", font,
> FontStyle.Bold, GraphicsUnit.Pixel);
> >                     blueBrush = new
> SolidBrush(Color.FromName(sColor[random.Next(0, 139)]));
> >                     g.TextRenderingHint =
> TextRenderingHint.SystemDefault;
> > #if !_MONO
> >                     // Gamma correction value 0 - 12. Default is 4.
> >                     g.TextContrast = 4;
> > #endif
> >                     g.TextRenderingHint = TextRenderingHint.AntiAlias;
> > #if !_MONO
> >                     VideoPerf.Start();
> > #elif _MONO
> >                     timeStart = DateTime.Now;
> > #endif
> >                     g.DrawString("The quick brown fox jumps over a
> lazy dog!", tnrFont, blueBrush, new PointF(10, 3 * font));
> > #if !_MONO
> >                     VideoPerf.Stop();
> >                     dDuration += VideoPerf.Duration(1);
> > #elif _MONO
> >                     timeEnd = DateTime.Now;
> >                     timeDifference = timeEnd.Subtract(timeStart);
> > #endif
> >                     #region Get Peformnace snap shot very 1000
> >                     if (i == 1000)
> >                     {
> >                         if (bKenny)
> >                         {
> >                             bKenny = false;
> >                             break;
> >                         }
> >                         i = 1;
> >                         g.Clear(Color.FromName(sColor[random.Next(0,
> 139)]));//this.BackColor);
> > #if !_MONO
> >                         dDuration /= 1000;
> > #elif _MONO
> >                         dDuration = timeDifference.Seconds;
> > #endif
> >                         dAvgTime = dDuration / (double)multiplier;
> >                         dNumPixels = (int)(iArea * dAvgTime * 1000);
> >                         if (bKenny)
> >                         {
> >                             bKenny = false;
> >                             break;
> >                         }
> >                         this.Text = sFuncName + " [ " +
> String.Format("{0:0,0}", dNumPixels) + " pixels/sec ]";
> >                     }
> >                     #endregion
> >                 }
> >                 catch { }
> >             }
> >             // Dispose of Graphics object
> >             blueBrush.Dispose();
> >             if (tnrFont != null)
> >             {
> >                 tnrFont.Dispose();
> >             }
> >             g.Dispose();
> >         }
> > 
> > Thanks.
> > 
> > =Tri.
> > 
> > -----Original Message-----
> > From: Valentin Sawadski [mailto:valentin.sawadski at gmx.de] 
> > Sent: Wednesday, September 19, 2007 3:34 PM
> > To: Nguyen, Tri
> > Subject: RE: FW: [MonoDevelop] Moving Focus Between Form
> > 
> > Hello Tri,
> > 
> > could it be that your are looking for something like that in the
> attachment?
> > 
> > And what parts of the code did you not understand, maybe I could help
> to answer some questions. :-)
> > 
> > Kind Regards,
> > Valentin
> > 
> > On Wed, 2007-09-19 at 15:22 -0500, Tri_Nguyen at Dell.com wrote:
> > > Thanks for your respond.  I am not sure if I understand your sample
> code 100%.  However, What I try to achieve here is to be able to stop
> the child form from the parent form "Stop" or "Exit" button.  I had
> register an event and if the "Stop" button click, it will signal the
> child form to close it gracefully.
> > > 
> > > Thanks.
> > > 
> > > -Tri.
> > > 
> > > -----Original Message-----
> > > From: Valentin Sawadski [mailto:valentin.sawadski at gmx.de]
> > > Sent: Wednesday, September 19, 2007 1:57 PM
> > > To: Nguyen, Tri
> > > Cc: mono-winforms-list at lists.ximian.com
> > > Subject: Re: FW: [MonoDevelop] Moving Focus Between Form
> > > 
> > > Hello,
> > > 
> > > On Wed, 2007-09-19 at 12:36 -0500, Tri_Nguyen at Dell.com wrote:
> > > > Thank you for your respond.  You are right that I am using 
> > > > "Form.ShowDialog".  However, I am using it in both Windows, and
> Linux.
> > > > The reason I am using "Form.ShowDialog" is because I want to
> monitor 
> > > > for the return of the form.
> > > > 
> > > > Is there a problem with "Form.ShowDialog"?
> > > 
> > > No there is no problem with ShowDialog but it blocks all other Forms
> of the Application, like you already noticed.
> > > 
> > > Howerver, a workaround would be to attach a delegate to the Closed 
> > > event of the Form and then read out the DialogResult manually. (See 
> > > the Attachment for a short sample)
> > > 
> > > Kind Regards,
> > > Valentin S.
> > > 
> > > > 
> > > > Thanks.
> > > > 
> > > > -Tri.
> > > > 
> > > > -----Original Message-----
> > > > From: Valentin Sawadski [mailto:valentin.sawadski at gmx.de]
> > > > Sent: Wednesday, September 19, 2007 10:34 AM
> > > > To: Nguyen, Tri
> > > > Cc: mono-winforms-list at lists.ximian.com
> > > > Subject: Re: [MonoDevelop] Moving Focus Between Form
> > > > 
> > > > Hello,
> > > > 
> > > > On Fri, 2007-09-14 at 12:41 -0500, Tri_Nguyen at Dell.com wrote:
> > > > > Hi I am new to Mono, and I not sure this is a right place to ask
> 
> > > > > this
> > > > > question:
> > > > > 
> > > > > 1.       I am trying to port a C# Windows app to Mono running on
> SLES
> > > > > 10.1.  The app starts with one form, and base on user input , it
> 
> > > > > can launch other forms.  When this happens, the new form gets 
> > > > > focus, and I can click on the previous form (parent?), and get 
> > > > > focus.  On mono, the app behaves differently:  I cannot get
> focus 
> > > > > back to the previous, unless I close the new form.
> > > > > 
> > > > > Any help on this matter would be appreciated.
> > > > 
> > > > As far as I know there's no bug in Form.Show, so my guess is that 
> > > > you call Form.Show on Windows and changed it to Form.ShowDialog 
> > > > while porting to Linux which would explain the behavior you
> mentioned.
> > > > 
> > > > However I you are sure that this is not the cause for the
> behavior, 
> > > > then please file a bug with a repro at http://bugzilla.novell.com.
> > > > 
> > > > Kind Regards,
> > > > Valentin S.
> > > > 
> > > > P.S. I cc'ed this message to the winforms list, so that more
> people 
> > > > concerned with WinForm will notice to this issue.



More information about the Mono-winforms-list mailing list