Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default First double-click lost?

I have an Excel application that includes a form with a couple of listboxes
and command buttons. For one of the listboxes I want to capture both
single-click and double-click events. So I have a bit of code like:

Private Sub lstMemberList_Change()
...
End Sub


Private Sub lstMemberList_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
...
End Sub ' lstMemberList_DblClick

If I launch the form, single-click an item and then double-click the same
item everything works OK.

If I launch the form, single-click an item and then double-click some other
item everything works OK.

However, if I launch the form and then immediately double-click an item I
get the Change event but never get the DblClick event. A subsequent
double-click in this same launch of the form works OK.

So it appears that the first double-click on the listbox after the form is
launched is lost. I tried recoding the Change event to a Click event and
that didn't make any difference. I've tested this in XL97 and 2003 with the
same results.

Any thoughts?

TIA,

josh


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default First double-click lost?

The problem seems to be that nothing in the listbox is selected until you
click on it; so the first click actually causes the Change event to occur
(you are changing from "Nothing" to the selected value). The only way I have
found around this is to set the listbox value by code first, e.g:
ListBox1.ListItem = 0. If this is on a userform you can set this when the
userform is activated, then the first click does not fire the Change event.

"Josh Sale" wrote:

I have an Excel application that includes a form with a couple of listboxes
and command buttons. For one of the listboxes I want to capture both
single-click and double-click events. So I have a bit of code like:

Private Sub lstMemberList_Change()
...
End Sub


Private Sub lstMemberList_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
...
End Sub ' lstMemberList_DblClick

If I launch the form, single-click an item and then double-click the same
item everything works OK.

If I launch the form, single-click an item and then double-click some other
item everything works OK.

However, if I launch the form and then immediately double-click an item I
get the Change event but never get the DblClick event. A subsequent
double-click in this same launch of the form works OK.

So it appears that the first double-click on the listbox after the form is
launched is lost. I tried recoding the Change event to a Click event and
that didn't make any difference. I've tested this in XL97 and 2003 with the
same results.

Any thoughts?

TIA,

josh



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default First double-click lost?

Actually when the listbox is populated with members, one of them is always
initially selected. ListItem is never = -1.

Any other ideas?

josh




"K Dales" wrote in message
...
The problem seems to be that nothing in the listbox is selected until you
click on it; so the first click actually causes the Change event to occur
(you are changing from "Nothing" to the selected value). The only way I
have
found around this is to set the listbox value by code first, e.g:
ListBox1.ListItem = 0. If this is on a userform you can set this when the
userform is activated, then the first click does not fire the Change
event.

"Josh Sale" wrote:

I have an Excel application that includes a form with a couple of
listboxes
and command buttons. For one of the listboxes I want to capture both
single-click and double-click events. So I have a bit of code like:

Private Sub lstMemberList_Change()
...
End Sub


Private Sub lstMemberList_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
...
End Sub ' lstMemberList_DblClick

If I launch the form, single-click an item and then double-click the same
item everything works OK.

If I launch the form, single-click an item and then double-click some
other
item everything works OK.

However, if I launch the form and then immediately double-click an item I
get the Change event but never get the DblClick event. A subsequent
double-click in this same launch of the form works OK.

So it appears that the first double-click on the listbox after the form
is
launched is lost. I tried recoding the Change event to a Click event and
that didn't make any difference. I've tested this in XL97 and 2003 with
the
same results.

Any thoughts?

TIA,

josh





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protected Worksheet, Cell Formatting Lost on Double Click? Louise Excel Discussion (Misc queries) 1 December 14th 08 12:38 PM
How to change syperlink from single click to double click syperlinker Excel Worksheet Functions 0 June 13th 08 05:01 PM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM
Mouse Over Graph, Capture Information on Click(Double Click) Dean Hinson[_3_] Excel Programming 1 December 6th 04 04:49 AM
lost double click ability to open files Don Excel Programming 1 April 27th 04 05:22 PM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"