R
RobRasti
I have a single form application for collecting ordering information.
The strange behavior is in a feature the customer has requested which
flows as follows:
- User enters Item Code 1, Qty X, Add Item to a List View control for
the user to see.
- User enters Item Code 2, Qty X, Add Item to a List View control for
the user to see.
- User enters Item Code 1 - Show anohter form allowing the user to
edit the Qty or remove the item or Cancel all together.
This all works fine, I can enter Code 1, Code 2, and Code 1 again and
I get my user control to display with 3 buttons (Save, Remove, Cancel)
and all works fine.
Now the customer comes back and requests that if the user taps the
item in the List View show the same prompt. So I now take the
SelectedIndexChange event from the ListView control and pass the
appropriate information to my user control to display on screen.
The screen show up fine, but when I attempt to tap any buttons they
don't even activate. I simply get a System Tap beep from the device.
The code I use to display the form in both cases is as follows:
private void showEditItem(LineItem itemToEdit)
{
if (m_frmEditItem == null) // My user control
{
m_frmEditItem = new ucEditItem();
m_frmEditItem.Parent = this.Parent // this is a User Control
(See note below for explaination)
// Attached to events raised by m_frmEditItem
}
m_frmEditItem.ItemCode = itemToEdit.ItemCode; // Setting on screen
data
m_frmEditItem.Show(); // Overloaded default Show method to place
the control at position 0,0, make visible...
}
The note about the Parent property: I am using a set of User Controls
on the form that simulate Forms. I am following the MVC Design
Pattern so this code resides in a Controller class, and the User
Controls are my View objects. The main drawing parent is my single
Form object, so by take this.Parent I am getting the Form object. I
have confirmed this to be true using breakpoints and watches.
Any ideas as to why the control would function as intended when the
above method is called on a KeyPress event vs being called on a
SelectedIndexChanged event?
Thanks in advance.
-Rob-
The strange behavior is in a feature the customer has requested which
flows as follows:
- User enters Item Code 1, Qty X, Add Item to a List View control for
the user to see.
- User enters Item Code 2, Qty X, Add Item to a List View control for
the user to see.
- User enters Item Code 1 - Show anohter form allowing the user to
edit the Qty or remove the item or Cancel all together.
This all works fine, I can enter Code 1, Code 2, and Code 1 again and
I get my user control to display with 3 buttons (Save, Remove, Cancel)
and all works fine.
Now the customer comes back and requests that if the user taps the
item in the List View show the same prompt. So I now take the
SelectedIndexChange event from the ListView control and pass the
appropriate information to my user control to display on screen.
The screen show up fine, but when I attempt to tap any buttons they
don't even activate. I simply get a System Tap beep from the device.
The code I use to display the form in both cases is as follows:
private void showEditItem(LineItem itemToEdit)
{
if (m_frmEditItem == null) // My user control
{
m_frmEditItem = new ucEditItem();
m_frmEditItem.Parent = this.Parent // this is a User Control
(See note below for explaination)
// Attached to events raised by m_frmEditItem
}
m_frmEditItem.ItemCode = itemToEdit.ItemCode; // Setting on screen
data
m_frmEditItem.Show(); // Overloaded default Show method to place
the control at position 0,0, make visible...
}
The note about the Parent property: I am using a set of User Controls
on the form that simulate Forms. I am following the MVC Design
Pattern so this code resides in a Controller class, and the User
Controls are my View objects. The main drawing parent is my single
Form object, so by take this.Parent I am getting the Form object. I
have confirmed this to be true using breakpoints and watches.
Any ideas as to why the control would function as intended when the
above method is called on a KeyPress event vs being called on a
SelectedIndexChanged event?
Thanks in advance.
-Rob-