John, here are the details.  The code below includes the basics that you
need in the "On Key Press" EEP.  I have expanded it to include a switch
statement so that I can search on multiple fields.  If you want me to, I
will put together a sample application but I won't be able to do that until
Wednesday or Thursday.  I have a full schedule today and tomorrow.

Create a form with a VAR Edit and a DB Grid
In my example the VAR Edit is called vKey_Stroke and the DB Grid is
tCUSTOMER.  The source table is called CUSTOMER.
Make sure that you predefine any of the variables that you use.
Add the following code to the "On Key Press" EEP in the VAR Edid
vKey_Stroke.
Change the field table name and field names to match your database.

SET VAR vlastkey TEXT = (LASTKEY(0)) --fetches the key that you last pressed
GETPROPERTY idKEY_STROKE textvalue 'vKEY_STROKE2' --Reads the data from
vKEY_STROKE
SET VAR vLIKE TEXT = (.vKEY_STROKE2+'%') --Adds the % so that I can use LIKE
in the Where
DROP TABLE tCUSTOMER
PROJECT TEMP tCUSTOMER FROM CUSTOMER +
USING lname,fname,midname,stadd,city,hometele,cust# +
WHERE lname LIKE .vlike +
ORDER BY lname,fname
PROPERTY table tCUSTOMER 'refresh'
RETURN

As Razzak would say, that's all there is to it!
I haven't tested the performance over a network but it is lighting fast on a
stand-alone PC.

John Engwer

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of John
Docherty
Sent: Monday, April 21, 2008 5:15 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Tip of the Day #4: Using "On Key Press" EEP for
Instant Results

John,

Would you be prepared to provide some more details of how you have
implemented this on the list ? I would be very interested to see what you
have done, as, as you say, this enhancement is very useful. I have an
application with a form using a DBGrid as the main data entry /editing form
which can certainly make use of this new feature - I would be most grateful
if you could show us what you have done to make use of this. 

Thank you.

Regards,
 
John Docherty

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of John Engwer
Sent: Monday, 21 April 2008 3:19 a.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Tip of the Day #4: Using "On Key Press" EEP for
Instant Results

Razzak, last evening I took some time to catch up on postings to rbase_l.  I
was two weeks behind.  Much to my delight, I discovered the "On Key Press"
enhancement.  Many of my clients are former Quickbooks users and they
frequently asked me to duplicate 'fill-in as you type" process that QB uses.
Until now, I had to tell them that I could not duplicate the process. 

As a test I modified one of my applications to make use of the new feature
and I am very impressed with the results.  I use the combination of a VAR
Edit and a DB Grid to select a customer from a list of 30,000.  Much to my
surprise, the list in the DB Grid refreshes instantaneously as you type.  I
thought there would be a delay.  It only takes a few lines of code in the
EEP to get lightning fast results.  I plan to create a proc and call this
procedure throughout my applications.

THANKS for this very useful enhancement!

John

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of A. Razzak
Memon
Sent: Monday, April 07, 2008 5:45 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Tip of the Day #4: Using "On Key Press" EEP for Instant
Results

Monday, April 7, 2008

Tip of the Day #4: Using "On Key Press" EEP for Instant Results

Section: Form Controls (DB and Variable Edit Controls)

Supported Versions:

. R:BASE 7.6 (Build 7.6.3.30404 or higher) for Windows
. R:BASE C/S:I 7.6 (Build 7.6.3.30404 or higher) for Windows
. R:BASE Turbo (Build 8.0.17.30404 or higher) for Windows

Did you know that you can use the new "On Key Press" EEP to
execute a defined code while start typing a character in DB
Edit or Variable Edit control?

Use "On Key Press" EEP, an event handler to make something
happen as a result of a single character key press.

The Key parameter in the On Key Press event handler is of type
TEXT; therefore, the On Key Press event registers the ASCII
character of the key pressed. Keys that don't correspond to an
ASCII Char value (Shift or F1, for example) don't generate an
On Key Press event. Key combinations (such as Shift+A), generate
only one On Key Press event (for this example, Shift+A results
in a Key value of "A" if Caps Lock is off).

Examples:

http://www.rupdates.com/sat2008/samples/UsingOnKeyPressEEP_01.jpg
http://www.rupdates.com/sat2008/samples/UsingOnKeyPressEEP_02.jpg
http://www.rupdates.com/sat2008/samples/UsingOnKeyPressEEP_03.jpg

A sample application to demonstrate the use of "On Key Press" EEP
is also available at:

2008 SAT Sample Applications: http://www.rupdates.com/SAT2008/

Folder: \DesigningSearchScreensUsingKeyPressOption
Database: KeyPress
Form: SearchAndEditCust2
Command File: DesigningSearchScreensUsingKeyPressOption.dat

Very Best R:egards,

Razzak.


Reply via email to