Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox problem
Message
From
12/12/2005 14:34:11
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01077137
Message ID:
01077264
Views:
28
>Hi everybody,
>
>I have the following code in my combobox valid method:
>
>local lcPK
>lcPK = this.value
[snip]
>endwith
>
>The problem is, that once I selected the value and want to select another and try to quickly type some letters, it fires the message right away for only the first letter I typed. What should I change to make it react on all the letters I quickly type and don't get me message until I really selected the value?

The only solution I can see here is to have a timer which would have _dblclick+1 for .interval, would be started in combo's .GotFocus() and be reset for each keypress() and interactivechange() of the first combo, and would set some property once it gets the chance to fire its .timer() event. Then in the combo's valid, if this property is set, validate, if not, just return 1. In combo.lostFocus(), disable the timer.

In this scenario, when your combo gets focus, the timer starts ticking, but each time you change the value of the combo, the timer starts ticking from zero. So as long as you keep typing, it doesn't validate (or doesn't go through validation - it jumps out). Once you make a _dblclick sized break, the timer eventually fires, sets that property, calls the validation, stops. In .lostFocus you should just stop the timer.

There are problems here with this solution as well. If you've clicked out of the combo, then what - there's no interactive change, and you may still have done this before the _dblclick seconds have expired, so it wouldn't validate.

Another thing that comes to my mind - what's the length of your key to the other combo? Maybe you can just skip validation if insufficient length was entered.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform