How to block itemCheck event when I doubleClick in a listView

B

Bright Sun

Hi,

I have a ListView that is shown in Details mode, and the
Checkboxes property is set to true. My problem is that I
dont want the checkboxes being activated when items in
the ListView are double-clicked. Is this possible?

Thanks!

Bright
 
N

Nicholas Paldino [.NET/C# MVP]

Bright,

I don't think it is, you will have to code for it yourself. I think it
make sense though, as you need a single click to occur if you are going to
perform a double click.

What you could do is override the WndProc method and handle the
WM_LBUTTONUP message (or WM_LBUTTONDOWN) message. Once you have that, you
can set a timer to fire in the amount of time that a double click would
occur (the threshold). If the double click event fires, then cancel the
timer. If it doesn't, when the timer fires, fire the single click event,
and select the item.

Hope this helps.
 
B

Bright Sun

Thanks for your reply, Nicholas Paldino. But I have not got it yet. Do you
mind to give me a simple example please?

Bright

Nicholas Paldino said:
Bright,

I don't think it is, you will have to code for it yourself. I think it
make sense though, as you need a single click to occur if you are going to
perform a double click.

What you could do is override the WndProc method and handle the
WM_LBUTTONUP message (or WM_LBUTTONDOWN) message. Once you have that, you
can set a timer to fire in the amount of time that a double click would
occur (the threshold). If the double click event fires, then cancel the
timer. If it doesn't, when the timer fires, fire the single click event,
and select the item.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Bright Sun said:
Hi,

I have a ListView that is shown in Details mode, and the
Checkboxes property is set to true. My problem is that I
dont want the checkboxes being activated when items in
the ListView are double-clicked. Is this possible?

Thanks!

Bright
 
N

Nicholas Paldino [.NET/C# MVP]

Bright,

What do you have? How have you implemented this?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Bright Sun said:
Thanks for your reply, Nicholas Paldino. But I have not got it yet. Do you
mind to give me a simple example please?

Bright

message news:[email protected]...
Bright,

I don't think it is, you will have to code for it yourself. I think it
make sense though, as you need a single click to occur if you are going to
perform a double click.

What you could do is override the WndProc method and handle the
WM_LBUTTONUP message (or WM_LBUTTONDOWN) message. Once you have that, you
can set a timer to fire in the amount of time that a double click would
occur (the threshold). If the double click event fires, then cancel the
timer. If it doesn't, when the timer fires, fire the single click event,
and select the item.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Bright Sun said:
Hi,

I have a ListView that is shown in Details mode, and the
Checkboxes property is set to true. My problem is that I
dont want the checkboxes being activated when items in
the ListView are double-clicked. Is this possible?

Thanks!

Bright
 
B

Bright Sun

Hi Nicholas,

I have a ListView that is shown in Details mode. When I doubleclick an item,
I do not want change the checkbox status. Whatever a sample that can block
the itemCheck event will be fine. The thing is I do not know how to capture
the timer to decide a event is a doubleclick or not. Any sample can do this
will be great.

Thanks in ahead.



Nicholas Paldino said:
Bright,

What do you have? How have you implemented this?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Bright Sun said:
Thanks for your reply, Nicholas Paldino. But I have not got it yet. Do you
mind to give me a simple example please?

Bright

message news:[email protected]... think
it
going
to
perform a double click.

What you could do is override the WndProc method and handle the
WM_LBUTTONUP message (or WM_LBUTTONDOWN) message. Once you have that, you
can set a timer to fire in the amount of time that a double click would
occur (the threshold). If the double click event fires, then cancel the
timer. If it doesn't, when the timer fires, fire the single click event,
and select the item.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,

I have a ListView that is shown in Details mode, and the
Checkboxes property is set to true. My problem is that I
dont want the checkboxes being activated when items in
the ListView are double-clicked. Is this possible?

Thanks!

Bright
 

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