VMP Home
Product Information
Message Board
Download VMP
Training and Demos
Previous versions
User Contributions
VFP Tools & Downloads
Subscription Policy
Order Now
  txtPicklistValid bug fix when MoreThanOneHit()

In VMP version 2.0/2.01, when the user enters a value in a txtPicklistValid textbox that is not unique in the lookup table, the user is forced back into the picklist repeatedly (when the textbox is in a grid). I have come up with a solution that works for me. It may not be the best, but it seems to work. I have tried this in both my application and the VM example application. In case you are interested, here are the modifications I made to XXFWCTRL.VCX/txtPicklistValid:

1) Add two new properties:

ilpickedone - indicates the user has picked a value from the picklist

ilmorethanonehit - indicates there was more than one hit on the user's entry

2) At the end of the LostFocus() event method, add the following lines:

THIS.ilpickedone = .f.

THIS.ilmorethanonehit = .f.

3) Change one line in the Valid() event method:

from - IF THIS.ilSuppressValid

to - IF THIS.ilSuppressValid OR (THIS.ilpickedone AND THIS.ilMoreThanOneHit)

4) Change txtpicklistvalid::actiononinvalid():

IF THIS.ilpickedone AND THIS.ilMoreThanOneHit

* Dont do the picklist if there was more than one hit

* and the user already picked from the picklist



luPicklistValue = THIS.DoPicklistForm()



IF TYPE("oApp")="O" AND !ISNULL(oApp) AND oApp.GetPProp("ilTimingOut")




IF ISNULL(luPicklistValue)



THIS.ilpickedone = .T.

THIS.iuSelectedRecordValue = luPicklistValue



5) Insert the following line at the beginning of the custom DoPicklistForm() method:

THIS.ilpickedone = .F.

6) Insert the following at the beginning of the custom MoreThanOneHit() method:

llMoreThanOneHit = .f.

THIS.ilMoreThanOneHit = llMoreThanOneHit

7) Insert the following line just before the RETURN statement in the custom MoreThanOneHit() method:

THIS.ilMoreThanOneHit = llMoreThanOneHit


Charles Obadiah