1 |
A Simple Date Entry Textbox
by Jim Slater,
MVP,
Rocky Mountain Fox User Group
I love QuickBooks for all its great ease-of-use features. One of
these is the ability to press the plus (+) or minus
(-)
keys on a
date field to increment or decrement it. You can add this
behavior to your own VFP forms by creating a subclass of the
Textbox class to use specifically for date entry. Put the code
shown below in the Keypress method of this date-entry sub-
class. In VFP 5.0, you can select Tools
I
Options / Field
Mapping from the menu, and make this new class the default
that VFP will always use when you drag a date field to a form in
design mode.
Key press method
LPARAMETERS nKeyCode, nShiftAltCtrl
*
Define the ASCII codes for
+
and
#DEFINE KEYCODE_PLUS 43
#DEFINE KEYCODE_MINUS 45
*
What data type is this control’s value?
LOCAL IcType
IcType
=
TYPE(”this.value”)
DO CASE
CASE lcType # “D” AND IcType # “T”
*
Oops, not a Date or Datetime!
*
Do nothing.
CASE nKeyCode
=
KEYCODE_PLUS
*
Override default VFP behavior:
NODEFAULT
IF EMPTY(THIS.VALUE)
*
If date is empty, change
*
to today’s date initially:
IF IcType
=
THIS.VALUE
=
DATEO
ELSE
THIS.VALUE
=
DATETIME()
ENDIF
ELSE
IF IcType
=
Increase the date by 1:
THIS.VALUE
=
THIS.VALUE
+1
ELSE
*
Datetime values are stored as
*
seconds, so add 1 day’s worth
THIS.VALUE
=
THIS.VALUE
+
24*60*6C
ENDIF
ENDIF
CASE nKeyCode
=
KEYCODE_MINUS
(Con’t, Page 2)
At LA Fox
April
21, 1997,
7:30 PM
-
David Greene. David returns for a
session on basic HTML and introduction to the Internet Data-
base Connector, the tool he’s currently using at
http://
wt’wv.prodsolu.com
in the database demo.
May 19, 1997, 7:30 PM
-?????.
With the Spring Conference
on May 17-18, who knows who will show up at this meeting?
Since We Last
Met
The LA Fox Board. As announced at the last meeting, Twila
Miller will be taking over for outgoing Treasurer Allen Garfein
(effective immediately) and Bill Anderson, current Vice Presi-
dent, will add “Speakers and Programs” to his list of responsi-
bilities (effective with the June meeting). Twila and Bill have been
members of LA Fox for many years. So if you have questions
concerning membership/dues, call Twila at 310/318-6366, ore-
mail her at
tamiller@earthlink.net
or
71614.3530@compuserve.
corn.
And if you have questions or suggestions for guest speakers,
please contact Bill Anderson at 213/851-7725 or e-mail him at
billand@primenet.com.
Whenever we have a change of officers
at LA Fox, I’m always questioned about how they get elected.
So for those people that are new to LA Fox, you can continue
reading. For you “old-timers and lifers”, you can skip the next
paragraph, since you’ve probably heard it about a half-dozen
times by now.
About
the
Board. The Board is comprised of volunteers from
within the group. Any current (read paid-up) member of the
(Con’t, page 2)
Page 3
Page 4
Page 6
and much more
The LA Fox Developer
A Newsletter for
FoxPro
Application Developers in Southern California
April 1997
Out and About
by Barry R. Lee
The April meeting of LA Fox will be held on
April 21, 1997, at 7:30 PM at our regular
meeting place (the Torrance Airport, 3301
Airport Drive, in Torrance). For details on
how to get there, see the map on the back
page.
In this
issue
Power of Business Objects
Undocumented foxtools.fll
Using VFP 5.0 Grids
|
1 |