Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keypress - incremental lookup and typing speed
Message
From
22/04/2002 04:29:58
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
21/04/2002 20:43:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00647269
Message ID:
00647459
Views:
13
Hi Andrew

Jim and Walter are trying to save you lots of headaches. There's no single answer in VFP (or QuickBooks either, I'd bet) that can work with as many as 150,000 items and as few as 2 items. I wouldn't want to start building such a control from scratch.

There are lots of issues that you'd have to handle if you want to roll your own combobox replacement. IMO Visual MaxFrame Professional (VMP) has a very good combobox replacement. You'd have to do something to make it look like QuickBooks' control.

The advantage this control has over the combobox, is there is no pre-population of the combos list of items, so it can work with huge lists or really small ones. I like this control so much I never use combos anymore.

The control works best when it has direct access to the table. However, its not always possible to use the table. You can query a view or do an SQL into a cursor, and index that cursor when the control inits. However, 150,000 records is going to be a problem. You might want to requery the list after each keystroke, extracting only the closest matching records. But that can still be a problem with large lists, there might be thousands of records starting with "A". I suggest you employ either of the following concepts, (again if you intend to roll your own control)...

1) Create a timer in the init of the control. Each keystroke resets the timer. When the timer runs out, requery the view / rerun the SQL. You'd be able to increase the time between keystrokes as much as you want. I've been planning to do something like this for VMP.

2) Wait until the user hits enter or tabs out of the control before doing the requery. That's the way I handle large lists now.

>>That's why I am doing an indexed SEEK on the source file. I would really like to know what goes on with the speed of typing. Why do keypresses override the code contained within the KEYPRESS method.<<

I remember using an ON KEY LABEL to call a program (MYPRG). If I hit the OKL again, before the first call was completed, that would call MYPRG again. Something like this helped ...

ON KEY LABEL CTRL+F12 DO MYPRG

MYPRG.PRG
IF TYPE("GPUBLIC") # "U"
RETURN
ENDIF
PUBLIC GPUBLIC
GPUBLIC = "ALREADY RUNNING"
...
Your code goes here
...
RELEASE GPUBLIC
Previous
Reply
Map
View

Click here to load this message in the networking platform