The Farber Consulting Group, Inc.

Tel: (516) 796-6545 / Fax: (516) 796-1273
E-Mail Me:
doron@dfarber.com
Our Web Site: http://www.dfarber.com

 

This following article was published in FoxTalk on Decemeber 1995

 

An Updated BlankFld() Function

 

SOME time ago I presented a function, BlankFld(), useful for blanking fields in response to pushing a button with the mouse
or a pen (see BIank the Current Field with Mouse or Pen", FoxTalk, June 1994). BlankFld() was designed specifically to
facilitate pen-based computer users in the field, when no keyboard is available. It also saves a lot of keystrokes when a
keyboard is available.

The reason I decided to modify this function is because one of my clients wanted to blank a date field. I hadn't anticipated this
requirement. As Murphy said,"lf something can to go wrong, it will." The following code shows the updated BlankFld() that
covers this new case. I didn't implement support for logical variables, since they're not "blankable," and BlankFld() offers no
advantage anyway for check boxes, which are usually associated with logical values:

 

*==================================================
* Function........: BlankFld
* Author..........: Doron Farber
* Created.........: 01/06/94
* Last Updated....: 01/01/96
* Purpose.........: To blank the current active field with one key
* ................: Stroke
* Project.........: Common
* Copyright.......: (c) The Farber Consulting Group
* Parameter List..:
* m.WhichField....: Gets the current field name via VARREAD()
* m.WhichObj. ....: Gets the current object number via _CUROBJ
* Calling.........: 
* ................: a) ON KEY LABEL F5 DO BlankFld WITH VARREAD(),_CUROBJ
* ................: b)0 19,48 GET m.AnyMemVar FUNCTION '*N \<BLANK' ;
*.................: DEFAULT 1; SIZE 1,7 WHEN MDOWN() VALID BlankFld()
*.................: c) Via a menu short cut
*.Return Type.....: None
* Notes...........: None
*==================================================
FUNCTION BlankFld
PARAMETERS m.WhichField,m.WhichObj

* Next two lines are in case called from an OKL
SET TYPEAHEAD TO 0
PUSH KEY CLEAR

IF PARAMETERS()==2
 m.NowField=m.WhichField
 m.NowObj=m.WhichObj
ENDIF

m.WhichOne=TYPE(EVAL(m.NowField'))

DO CASE
 CASE m.WhichOne=='N'
  STORE O TO (m.NowPield)
 CASE m.WhichOne=='C'
  STORE SPACE(LEN(EVAL(m.NowField))) TO (m.NowField)
 CASE m.WhichOne=='D'
 STORE {} TO (m.NowField)
ENDCASE
SHOW GET (m.NowField) ENABLE
_CUROBJ = m.NowObj
*Next three lines are in case this routine was called from an OKL
CLEAR TYPEAHEAD
SET TYPEAHEAD TO 128 && or to whatever you like
POP KEY
RETURN .T.