D
David
Hi,
I am not sure if this is a general framework question or specific to the
device.
I am using CF 1.
I have my own numeric input panel (larger buttons required...). When I enter
a textbox, I use its onfocus event to fire up the panel. (the panel is on
its own form).
When I finished with the panel, it will close and return to the main form
the value entered, however, when the main form re-appears, it re-fires the
gotfocus, restarting my numeric panel.
How can I get around this. (I have tried a toggle to stop it, I have tried
setting focus to something else)
Here is my code...
bool ValueInFocus = false;
NumericPad NumPad;
private void ActualValues_GotFocus(object sender, System.EventArgs e)
{
if (!ValueInFocus)
{
ValueInFocus = true;
NumPad = new NumericPad();
NumPad.Actual = Convert.ToDouble(dTable.Rows[RecordIndex]["Actual"]);
NumPad.Upper = Convert.ToDouble(dTable.Rows[RecordIndex]["Upper"]);
NumPad.Nominal = Convert.ToDouble(dTable.Rows[RecordIndex]["Nominal"]);
NumPad.Lower = Convert.ToDouble(dTable.Rows[RecordIndex]["Lower"]);
NumPad.Closing += new
System.ComponentModel.CancelEventHandler(this.numPad_Closing);
NumPad.Closed += new System.EventHandler(this.numPad_Close);
NumPad.ShowDialog();
NumPad.Dispose();
}
// Problem with number actualvalue retaining focus and causing number
panel to pop-up again.
//SaveButton.Focus();
}
private void numPad_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
dTable.Rows[RecordIndex]["Actual"] = NumPad.Actual;
ActualValues.Text = dTable.Rows[RecordIndex]["Actual"].ToString();
CalculateError();
SaveButton.Focus();
}
private void numPad_Close(object sender, EventArgs e)
{
ValueInFocus = false;
}
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
I am not sure if this is a general framework question or specific to the
device.
I am using CF 1.
I have my own numeric input panel (larger buttons required...). When I enter
a textbox, I use its onfocus event to fire up the panel. (the panel is on
its own form).
When I finished with the panel, it will close and return to the main form
the value entered, however, when the main form re-appears, it re-fires the
gotfocus, restarting my numeric panel.
How can I get around this. (I have tried a toggle to stop it, I have tried
setting focus to something else)
Here is my code...
bool ValueInFocus = false;
NumericPad NumPad;
private void ActualValues_GotFocus(object sender, System.EventArgs e)
{
if (!ValueInFocus)
{
ValueInFocus = true;
NumPad = new NumericPad();
NumPad.Actual = Convert.ToDouble(dTable.Rows[RecordIndex]["Actual"]);
NumPad.Upper = Convert.ToDouble(dTable.Rows[RecordIndex]["Upper"]);
NumPad.Nominal = Convert.ToDouble(dTable.Rows[RecordIndex]["Nominal"]);
NumPad.Lower = Convert.ToDouble(dTable.Rows[RecordIndex]["Lower"]);
NumPad.Closing += new
System.ComponentModel.CancelEventHandler(this.numPad_Closing);
NumPad.Closed += new System.EventHandler(this.numPad_Close);
NumPad.ShowDialog();
NumPad.Dispose();
}
// Problem with number actualvalue retaining focus and causing number
panel to pop-up again.
//SaveButton.Focus();
}
private void numPad_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
dTable.Rows[RecordIndex]["Actual"] = NumPad.Actual;
ActualValues.Text = dTable.Rows[RecordIndex]["Actual"].ToString();
CalculateError();
SaveButton.Focus();
}
private void numPad_Close(object sender, EventArgs e)
{
ValueInFocus = false;
}
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available