Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 6 ListBox Click Event randomly not firing

Status
Not open for further replies.

MamaCIG

Programmer
Feb 21, 2001
10
US
I have a top level modeless form with text boxes and a grid with multiple columns, rowsource is a .dbf which I append blank records to. All works fine. Now, I have added a listbox which I enable/visible when user has keyed 4 characters into grid column 1. The listbox provides a list of up to 10 available codes they may choose from that "match" what they have entered so far. They can click a listbox item, and in the click event it pastes the code into the grid column, then returns focus to the grid column (from LostFocus code in listbox, I set focus to grid). Double click will paste and continue on to next grid column. Works great MOST (80%) of the time - but:
Randomly, the click or double-click event WON't fire when you click or dblclick a ListBox item. The ListBox.MouseDown fires, then the Form.MouseDown, then some MouseMove(and I ain't movin it - ListBox Mousedown and Form MouseUp have same coordinates!), then the Form.MouseUp, then the Form.Click!! The ListBox.Click doesn't fire, and my focus ends up in the textbox on the form with tab index 1. (all this info thanks to the debugger)

Has anyone out there experienced this? I am spinning my wheels trying to identify a cause.
 
My first impression is, that the fact of the Form getting events, and of you getting MouseDown & Up events with no Click, are both symptomatic of the control not yet being enabled.


so - how exactly is the listbox enabled, populated and disabled?
 
Chris - Thanks - you pointed me in the right direction - I moved my visible/enabled=.F. out of the grid column lostfocus where if was flag driven, and put it in other column gotfocus. Still mystified at the random nature of this, but I think it may have to do with sometimes a double mouse click being interpreted as two clicks instead. Anyway, I CAN'T get it to trip up so far. Guess this is the painful part about learning event firing sequence.
 
Glad it worked - but I'd interested to know, if you can be bothered -
If you put the code in the Valid event of the column instead of in the LostFocus event, does that make any difference?
(If you can't be bothered, no problem)
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top