Trying to get the killfocus event to work on several variables.
vDateEvent works ... converts vDate to date format
vLocationEvent.. don't allow a blank value in vLocation
vLogEvent creates filename from input variables and saves vLogdata
I cannot see how to get the "OK" & "cancel" to be used with the other codings
getting my conditions muddled somewhere in the %code" section, but cannot see it.
Can anyone please tell me where I am going wrong?
Code:
DIM form_name as C
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
DIM SHARED vDate as D
DIM SHARED vPlaceNo as C = "01"
DIM SHARED vLocation as C
DIM SHARED vLogData as C
DIM SHARED varC_result as C
DELETE expression_result
expression_result = eval("date()",form_name)
vDate = convert_type(expression_result,"D")
DIM vLocation_def as C
vLocation_def = "ke=logging_where,{keylist_build(\"H=.05,1:25\",''+where,left(''+where,25))}{}"
varC_result = ui_dlg_box("Enter Logging",<<%dlg%
{Background=#153+204+255}
{region}
Date:| [%DATE;P=popup.calendar(dtoc(vDate));I=popup.calendar%.16vDate!vDateEvent_*];
Place Number:| [.3vPlaceNo];
Location:| [%@vLocation_def%.40vLocation!vLocationEvent_*];
Log:| [%mw%.40,12vLogData!vLogEvent_*];
{endregion};
{line=1,0};
{region}
<*10OK!OK> <10Cancel!CANCEL>
{endregion};
%dlg%,<<%code%
if a_dlg_button = "OK" .or. a_dlg_button = "CANCEL" then
'do nothing - the dialog will close
elseif left(a_dlg_button,11) = "vDateEvent_" then
if a_dlg_button = "vDateEvent_killfocus" then
vDate = ctod(dtoc(vDate))
end if
a_dlg_button = ""
elseif left(a_dlg_button,15) = "vLocationEvent_" then
if a_dlg_button = "vLocationEvent_killfocus" then
if vLocation = "" then
ui_msg_box("error","Location Required")
a_dlg_button = ""
else
vLocation = upper(vLocation)
a_dlg_button = ""
end if
end if
a_dlg_button = ""
elseif left(a_dlg_button,10) = "vLogEvent_" then
if a_dlg_button = "vLogEvent_Killfocus" then
header_text = "#"-dtoc(vDate)-"|"-vPlaceNo-"|"-vLocation
vLogFileData = upper(header_text+crlf()+vLogdata)
' dim st as Y
' st = now()
' ctimestamp = left(cshorttime(st),4)
' cDatestamp = dtos(vDate)
' vLogFileName = filename_decode("[logPath]\\"+remspecial(rtrim(vLocation))+cDatestamp+"@"+ctimestamp+".log")
' showvar(vLogfileName)
' save_to_file(vLogFileData,vLogFileName)
a_dlg_button = ""
end if
a_dlg_button = ""
else
a_dlg_button = ""
end if
%code%)
if varC_result = "OK" then
showvar(vLogFileData)
end if
Bookmarks