taor 29 posts since
Jul 9, 2008
2.
Re: about datefield Jul 9, 2008 11:05 PM

in response to:
fukuta
thank you very much! But,if the format is not fixed,how to do?
for example:
i want to input the date with "format1"(when focus into the datefield,the date is formated with format1) and i want to display the date with "format2" (when focus out the datefield,the date is formated with format2) .
format1 and format2 is not fixed.they are user defined.
now ,i can do the format change with method FocusIn and FocusOut, but when the format1 is not type of datetime ,i can't change the date.
source:
{self.add-event-handler
{on FocusIn do
set self.format-spec = {proc { date:DateTime,
df:DateField}:String
{return {Format self.value.info.locale-date, Format = self.Format}}
}
}
}
{self.add-event-handler
{on FocusOut do
set self.format-spec = {proc { date:DateTime,
df:DateField}:String
{return {Format self.value.info.locale-date, Format = self.DisplayFormat}}
}
}
}