Allowing Users to easily clear a date field

Chris Kelleher

Administrator
Staff member
This code was posted on PEG by Tom Bergman
(Tom_Bergman@SilverPlatter.com)

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>/*cleardat.p*/
/* This procedure creates triggers on all date fill-ins in a frame.
The triggers allow users to press the space key or the delete
key to enter the unknown value. */

DEF INPUT PARAMETER frame-hand AS WIDGET-HANDLE NO-UNDO.

DEF VAR grp AS WIDGET-HANDLE.
DEF VAR flw AS WIDGET-HANDLE.
DEF VAR OK AS LOG NO-UNDO.

grp = frame-hand:FIRST-CHILD.
DO WHILE grp NE ?:
flw = grp:FIRST-CHILD.
DO WHILE flw NE ?:
IF flw:TYPE = "fill-in" AND
flw
biggrin.gif
ATA-TYPE = "date"
THEN DO:
ON delete-character," " OF flw PERSISTENT RUN clearda2.p (flw).
END.
flw = flw:NEXT-SIBLING.
END.
grp = grp:NEXT-SIBLING.
END.

/* Clearda2.p */
/* This program gets called by cleardat.p. It is used
to allow the user to clear (enter the unknown value)
by pressing space or delete */

DEF INPUT PARAMETER flw AS WIDGET-HANDLE.
APPLY "?" TO flw.
RETURN ERROR.


[/code]

[This message has been edited by progresstalk (edited 06 December 1999).]
 

Jenie888

Member
Why not just - Delete

Why not just do a keyboard event trigger using the delete key.

the trigger would be called: DELETE-CHARACTER.
on choose of delete button you can:
assign self:screen-value = ?.

You can make this trigger go off any way you wish by calling it:
apply "DELETE-CHARACTER" to scr-Date.



Jenie
 
Top