Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Protected Worksheet, Cell Formatting Lost on Double Click? | Excel Discussion (Misc queries) | |||
How to change syperlink from single click to double click | Excel Worksheet Functions | |||
Click on graph bar to execute a double-click in a pivot table cell | Charts and Charting in Excel | |||
Mouse Over Graph, Capture Information on Click(Double Click) | Excel Programming | |||
lost double click ability to open files | Excel Programming |