GotFocus event

M

Mats Boberg

Hi,

I have a Dialog with a button. When you click the button a new dialog opens.

Why does the GotFocus event happens when the dialog is created(see code
below)?

/Mats.



/// <summary>

/// addItemButton click event

/// </summary>

/// <definition>[C#]

/// private void addItemButton_Click(

/// object sender,

/// System.EventArgs e

/// )

/// </definition>

/// <created>2003-03-27</created>

/// <author>MBo</author>

/// <param name="sender">Provided by framework</param>

/// <param name="e">Provided by framework</param>

private void addItemButton_Click(object sender, System.EventArgs e) {


try {

//show waitcursor

Cursor.Current = Cursors.WaitCursor;

Cursor.Show();

// Add item to items list and trolly

AddItemForm addItemForm = new AddItemForm();
<------------------------------------------------ GotFocus event

addItemForm.WorkCard = workCard;


// Hide form from running programs

this.Text = "";


// Show form as a dialog

addItemForm.ShowDialog();

// show form in running programs

this.Text = WPAClientCommon.LangResourceManager.GetString("WorkOrderForm");



//clear

addItemForm.Dispose();

addItemForm = null;

} catch (Exception ex) {

// Log error

MessageBox.Show(WPAClientCommon.LangResourceManager.GetString("Error_Msg_Ser
iousError"),WPAClientCommon.LangResourceManager.GetString("Error_Msg_Header"
), MessageBoxButtons.OK, MessageBoxIcon.Hand,
MessageBoxDefaultButton.Button1);

// Hide messagebox faster

Application.DoEvents();

}


}


--
Mats Boberg

Regfellow
Kattsundsgatan 12:5tr
21126 Malmö

Tele: +46 40 611 48 20
Mob: + 46 70 486 87 57
 
K

Katie Schaeffer [MSFT]

Hi Mats,

Try upgrading to SP2. We fixed a flicker bug that occured when forms were
created that might solve this problem for you as well.

-Katie

This posting is provided "AS IS" with no warranties, and confers no rights.

***.Net Compact Framework Info***
Faq:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.a
spx
QuickStarts: http://samples.gotdotnet.com/quickstart/CompactFramework/
Samples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/h
tml/CompactfxTechArt.asp

--------------------
| From: "Mats Boberg" <[email protected]>
| Subject: GotFocus event
| Date: Wed, 17 Dec 2003 21:07:18 +0100
| Lines: 107
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: h49n2fls20o825.bredband.comhem.se 217.208.130.49
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:41192
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi,
|
| I have a Dialog with a button. When you click the button a new dialog
opens.
|
| Why does the GotFocus event happens when the dialog is created(see code
| below)?
|
| /Mats.
|
|
|
| /// <summary>
|
| /// addItemButton click event
|
| /// </summary>
|
| /// <definition>[C#]
|
| /// private void addItemButton_Click(
|
| /// object sender,
|
| /// System.EventArgs e
|
| /// )
|
| /// </definition>
|
| /// <created>2003-03-27</created>
|
| /// <author>MBo</author>
|
| /// <param name="sender">Provided by framework</param>
|
| /// <param name="e">Provided by framework</param>
|
| private void addItemButton_Click(object sender, System.EventArgs e) {
|
|
| try {
|
| //show waitcursor
|
| Cursor.Current = Cursors.WaitCursor;
|
| Cursor.Show();
|
| // Add item to items list and trolly
|
| AddItemForm addItemForm = new AddItemForm();
| <------------------------------------------------ GotFocus event
|
| addItemForm.WorkCard = workCard;
|
|
| // Hide form from running programs
|
| this.Text = "";
|
|
| // Show form as a dialog
|
| addItemForm.ShowDialog();
|
| // show form in running programs
|
| this.Text =
WPAClientCommon.LangResourceManager.GetString("WorkOrderForm");
|
|
|
| //clear
|
| addItemForm.Dispose();
|
| addItemForm = null;
|
| } catch (Exception ex) {
|
| // Log error
|
|
MessageBox.Show(WPAClientCommon.LangResourceManager.GetString("Error_Msg_Ser
|
iousError"),WPAClientCommon.LangResourceManager.GetString("Error_Msg_Header"
| ), MessageBoxButtons.OK, MessageBoxIcon.Hand,
| MessageBoxDefaultButton.Button1);
|
| // Hide messagebox faster
|
| Application.DoEvents();
|
| }
|
|
| }
|
|
| --
| Mats Boberg
|
| Regfellow
| Kattsundsgatan 12:5tr
| 21126 Malmö
|
| Tele: +46 40 611 48 20
| Mob: + 46 70 486 87 57
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top