2011-04-18 20:08 UTC
I use those events to validate values, here is an example:
;ELEVATION PRECISION TEXTBOX
(defun c:frmEditVA_txtElevPrec_OnKillFocus ()
(frmEditVA_txtElevPrec_Validate)
)
(defun c:frmEditVA_txtElevPrec_OnReturnPressed ()
(frmEditVA_txtElevPrec_Validate)
)
(defun frmEditVA_txtElevPrec_Validate ( / Value)
(Setq Value (CT-REMOVE-CHARS (DCL_Control_GetProperty (vl-doc-ref 'CT-Civil10-B_frmEditVA_txtElevPrec) "Text")))
(IF (= (CHECK_FOR_NUM Value) 0)
(PROGN
(PUT-GVAR "ELEVPREC" (ATOI Value) "CT-EDITVA-GVAR")
(FIX-GVARS "CT-EDITVA-GVAR" (CT-EDITVA-GVAR-LIST))
(PUT-CT-EDITVA-GVAR-INFILE)
(frmEditVA_DoGrid)
)
(PROGN
(ALERT "Precision was not valid")
(DCL_Control_SetProperty (vl-doc-ref 'CT-Civil10-B_frmEditVA_txtElevPrec) "Text"
(ITOA (GET-GVAR "ELEVPREC" "CT-EDITVA-GVAR"))
)
)
)
)
Those two events fire twice every time. Would not matter, but sometimes I give user feedback like the alert shown, and that shows twice.
I brought this up in the past, am not sure if its proper behavior though.
Note that OnReturnPressed should not fire at all IMO, if you click to another control, just OnKillFocus should fire.
;ELEVATION PRECISION TEXTBOX
(defun c:frmEditVA_txtElevPrec_OnKillFocus ()
(frmEditVA_txtElevPrec_Validate)
)
(defun c:frmEditVA_txtElevPrec_OnReturnPressed ()
(frmEditVA_txtElevPrec_Validate)
)
(defun frmEditVA_txtElevPrec_Validate ( / Value)
(Setq Value (CT-REMOVE-CHARS (DCL_Control_GetProperty (vl-doc-ref 'CT-Civil10-B_frmEditVA_txtElevPrec) "Text")))
(IF (= (CHECK_FOR_NUM Value) 0)
(PROGN
(PUT-GVAR "ELEVPREC" (ATOI Value) "CT-EDITVA-GVAR")
(FIX-GVARS "CT-EDITVA-GVAR" (CT-EDITVA-GVAR-LIST))
(PUT-CT-EDITVA-GVAR-INFILE)
(frmEditVA_DoGrid)
)
(PROGN
(ALERT "Precision was not valid")
(DCL_Control_SetProperty (vl-doc-ref 'CT-Civil10-B_frmEditVA_txtElevPrec) "Text"
(ITOA (GET-GVAR "ELEVPREC" "CT-EDITVA-GVAR"))
)
)
)
)
Those two events fire twice every time. Would not matter, but sometimes I give user feedback like the alert shown, and that shows twice.
I brought this up in the past, am not sure if its proper behavior though.
Note that OnReturnPressed should not fire at all IMO, if you click to another control, just OnKillFocus should fire.