>Hi all,
> The solution that Christof Lange developed for
> Fox 2.x (See March 98 Advisor) uses the ObjVar()function.
> ObjVar()came out in 2.6 according to Hacker's guide.
> I'm using Fox 2.0 and wonder if there is a workaround
> for getting a GET object's variable name, knowing the GET number.
How do you feel about the following method, which won't
involve ON READERROR or _MSYSMENU:
*** BEGIN QUOTE ***
set talk off
* notes:
*
* 1. You can still input 2-digit years after setting century on
* 2. This method won't work with browse
*
set date british
set century off
set udfparms to value
public Y2K_VAR, Y2K_DATE, Y2K_ROLLOVER
*
* there can only be one variable ebgin READ at any time
*
* alternative
* Y2K_ROLLOVER = year(date())-1905
*
Y2K_ROLLOVER = 93
Y2K_VAR = ""
Y2K_DATE = {//}
m.ddate = {01/01/98}
clear
*
* the original code:
*
* @ 05,05 say "Date: " get m.ddate valid myvalid()
*
@ 05,05 say "Date: " get Y2K_DATE ;
picture " / / " ;
when y2k_when("ddate") ;
valid y2k_valid() and myvalid()
read cycle
set talk on
return
function myvalid
set century on
wait window nowait "Result --> "+dtoc(m.ddate)
set century off
return .t.
function y2k_when
parameter m.varname
private o_century
Y2K_VAR = m.varname
Y2K_DATE = dtoc(eval(Y2K_VAR))
return .t.
function y2k_valid
private o_century, m.year
o_century = set("century")
set century on
m.year=right(Y2K_DATE,2)
if val(m.year) < Y2K_ROLLOVER
Y2K_DATE=left(Y2K_DATE,6)+"20"+m.year
else
Y2K_DATE=left(Y2K_DATE,6)+"19"+m.year
endif
Y2K_DATE = ctod(Y2K_DATE)
set century &o_century
if empty(Y2K_DATE)
* invalid dates
return .f.
endif
&Y2K_VAR = Y2K_DATE
*
* for browse, change thsi to:
* replace (Y2K_VAR) with Y2K_DATE
*
return .t.
Regards,
Mr. Man-wai Chang