ComboBox MouseDoubleClick Event Never Fires

  • Thread starter Thread starter senfo
  • Start date Start date
S

senfo

Hello All,

For some reason, the MouseDoubleClick event for my ComboBox does not
appear to be working. I am not subscribed to any other events for this
control. I pulled out Spy++ and noticed that the WM_LBUTTONDBCLICK
message is indeed occurring. The ComboBox does not provide a
DoubleClick event like other controls do.

The Windows application is being developed in VS 2005.

Any ideas?

Thank you in advance,
 
"The ComboBox does not provide a DoubleClick event like other controls do."
.......and therein lies the answer.

every time you left click the WM_LBUTTONDBCLICK will fire, doesn't mean your
combo is listening to it. You have to assign that event to the combo. In
visual studio this is really easy, in the designer click the combo, in the
properties windo on the right click the lightening symbol and scroll down to
the left click or whatever event it is (cant remember exact name of my head)
and double click in there. it hooks the event and creates the method for
you. Put your code in that method .
 
Daniel said:
"The ComboBox does not provide a DoubleClick event like other controls do."
......and therein lies the answer.

every time you left click the WM_LBUTTONDBCLICK will fire, doesn't mean your
combo is listening to it. You have to assign that event to the combo. In
visual studio this is really easy, in the designer click the combo, in the
properties windo on the right click the lightening symbol and scroll down to
the left click or whatever event it is (cant remember exact name of my head)
and double click in there. it hooks the event and creates the method for
you. Put your code in that method .

Hi Daniel,

Thank you for your reply. The problem isn't with subscribing to the
event, the problem is that the event is never raised. Some controls
provide the "Action" events Click, DoubleClick, MouseClick, and
MouseDoubleClick. The MouseClick events are similar to the Click
events; however, the MouseEvent events have an extended EventArgs class
for providing more detail about the click. The ComboBox control does
not provide the DoubleClick event; however, the other three (Click,
MouseClick, and MouseDoubleClick) do exist.

The *only* event that I subscribe to on the ComboBox is the
MouseDoubleClick event. I've read cases where the MouseDoubleClick
event is not raised when, for example, you subscribe to the Click event.
However, since I am not subscribed to anything else, I don't
understand why the event would not be raised.

Thank you again,
 
Hi again ok to make it easier...

Assuming you want the value of the combo at the point of change (when the
click a choice)

You want to double click the event that says SelectionValueChanged

Then do this int he method created

private void comboBox1_SelectedValueChanged(object sender, EventArgs e)

{

ComboBox senderComboBox = (ComboBox)sender;

MessageBox.Show(senderComboBox.Text);

}



Code above will fire a message box showing the value selected. Anything you
need you can access from the senderComboBox .
 
Daniel said:
Hi again ok to make it easier...

Assuming you want the value of the combo at the point of change (when the
click a choice)

You want to double click the event that says SelectionValueChanged

Then do this int he method created

private void comboBox1_SelectedValueChanged(object sender, EventArgs e)

{

ComboBox senderComboBox = (ComboBox)sender;

MessageBox.Show(senderComboBox.Text);

}

Hi Daniel,

Thank you again for your reply. Unfortunately, this won't work for me.
I really need the double click event to be raised.

I read in a blog post somewhere that the ComboBox has an internal
TextBox, which "eats" the DoubleClick event. I have not confirmed this,
nor have I found a workaround other than using a timer.

Thank you again,
 

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

Back
Top