SIP and TexBox BUG?

  • Thread starter Thread starter Jose
  • Start date Start date
J

Jose

Hello, I'm programming a form that the user can input data. In this form I
have one TexBox whit PasswordChar. When this TexBox recieves the Focus, it
activate inputPanel1_EnabledChanged Event. Why?????, the others TexBox that
not have PasswordChar property not make this event.

This is part of my code:

Inicialization
.....
this.textBoxPass.Location = new System.Drawing.Point(136, 112);

this.textBoxPass.PasswordChar = '*';

this.textBoxPass.Size = new System.Drawing.Size(80, 20);

this.textBoxPass.Text = "";

this.inputPanel1.EnabledChanged += new
System.EventHandler(this.inputPanel1_EnabledChanged);
......


private void inputPanel1_EnabledChanged(object sender, EventArgs e)

{


if (inputPanel1.Enabled )

{

tabControl1.Size = new System.Drawing.Size (tabControl1.Size.Width ,
tabControl1.Size.Height - inputPanel1.Bounds.Size.Height);

}

else

{

tabControl1.Size = new System.Drawing.Size (tabControl1.Size.Width ,
tabControl1.Size.Height + inputPanel1.Bounds.Size.Height);

}

}

Thanks.

Sorrry my English is not very good :(
 
Jose:

Do you have any code behind the Password TextBox enabling the SIP? I can't
tell from the snippet, but it sounds like something is firing enabled_Change
from the text box.
 
Hello Wiliam, I haven't any code enabling the SIP, I don't want that the SIP
fire the event when Password TextBox get the focus.
In my first version all textbox when they get the focus test if the SIP is
enable, and if not is enable I enable the SIP, but when Password texbox
before get focus the event inputPanel1_EnabledChanged is fired and next the
event gotFocus is fired. Only happens this when Password textbox have
PasswordChar property "enabled".

I show you an example of this situation:

using System;

using System.Drawing;

using System.Collections;

using System.Windows.Forms;

using System.Data;

namespace SmartDeviceApplication11

{



public class Form1 : System.Windows.Forms.Form

{

private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.TextBox textBox2;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.TabControl tabControl1;

private System.Windows.Forms.TabPage tabPage1;

private System.Windows.Forms.MainMenu mainMenu1;

public Form1()

{



InitializeComponent();



}



protected override void Dispose( bool disposing )

{

base.Dispose( disposing );

}

#region Código generado por el Diseñador de Windows Forms



private void InitializeComponent()

{

this.mainMenu1 = new System.Windows.Forms.MainMenu();

this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();

this.textBox1 = new System.Windows.Forms.TextBox();

this.textBox2 = new System.Windows.Forms.TextBox();

this.label1 = new System.Windows.Forms.Label();

this.label2 = new System.Windows.Forms.Label();

this.tabControl1 = new System.Windows.Forms.TabControl();

this.tabPage1 = new System.Windows.Forms.TabPage();

//

// inputPanel1

//

this.inputPanel1.EnabledChanged += new
System.EventHandler(this.inputPanel1_EnabledChanged);

//

// textBox1

//

this.textBox1.Location = new System.Drawing.Point(24, 48);

this.textBox1.PasswordChar = '*';

this.textBox1.Size = new System.Drawing.Size(72, 20);

this.textBox1.Text = "";

this.textBox1.GotFocus += new
System.EventHandler(this.textBoxPass_GotFocus);

//

// textBox2

//

this.textBox2.Location = new System.Drawing.Point(24, 88);

this.textBox2.Size = new System.Drawing.Size(72, 20);

this.textBox2.Text = "";

this.textBox2.GotFocus += new
System.EventHandler(this.textBoxNormal_GotFocus);

//

// label1

//

this.label1.Location = new System.Drawing.Point(104, 48);

this.label1.Size = new System.Drawing.Size(104, 24);

this.label1.Text = "Password Texbox";

//

// label2

//

this.label2.Location = new System.Drawing.Point(104, 88);

this.label2.Size = new System.Drawing.Size(104, 24);

this.label2.Text = "Normal Texbox";

//

// tabControl1

//

this.tabControl1.Controls.Add(this.tabPage1);

this.tabControl1.SelectedIndex = 0;

this.tabControl1.Size = new System.Drawing.Size(240, 264);

//

// tabPage1

//

this.tabPage1.Controls.Add(this.textBox1);

this.tabPage1.Controls.Add(this.textBox2);

this.tabPage1.Controls.Add(this.label1);

this.tabPage1.Controls.Add(this.label2);

this.tabPage1.Location = new System.Drawing.Point(4, 4);

this.tabPage1.Size = new System.Drawing.Size(232, 238);

this.tabPage1.Text = "Test";

//

// Form1

//

this.Controls.Add(this.tabControl1);

this.Menu = this.mainMenu1;

this.Text = "Form1";

}

#endregion

/// <summary>

/// Punto de entrada principal de la aplicación.

/// </summary>

static void Main()

{

Application.Run(new Form1());

}

private void textBoxPass_GotFocus(object sender, System.EventArgs e)

{

if (!inputPanel1.Enabled)

inputPanel1.Enabled = true;


}

private void textBoxNormal_GotFocus(object sender, System.EventArgs e)

{

if (!inputPanel1.Enabled)

inputPanel1.Enabled = true;


}

private void inputPanel1_EnabledChanged(object sender, System.EventArgs e)

{

if (inputPanel1.Enabled )

{

tabControl1.Size = new System.Drawing.Size (tabControl1.Size.Width ,
tabControl1.Size.Height - inputPanel1.Bounds.Size.Height);

}

else

{

tabControl1.Size = new System.Drawing.Size (tabControl1.Size.Width ,
tabControl1.Size.Height + inputPanel1.Bounds.Size.Height);

}


}


}

}


If you select the normal textbox , the SIP show automatically and tab
control resize correctly, but if you select password textbox the same effect
is not produced.

I hope that you understand me.
Thanks.
 
Back
Top