Strange Enable/Disable behavior

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-
 
R

RobRasti

One followup point, the onlything disabled on the popup user control
is the button controls. The TextBox on screen will take input.

Thanks again.

-Rob-
 
R

RobRasti

So I've been playing around with this, and it appears that when I
display the user control from a KeyPress event it functions as
intended. When I show it from a SelectedIndexChanged event on the
ListView it seems to completely lock the user control for screen
input.

I've even changed some of the code from BackgroundUserControl.Enable =
false; to actually looping through each control and setting the enable
to false and still the user control will not funciton when shown from
the SelectedIndexChanged event.

Have I missed something in all of this?
 

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

Top