Subject | Re: [IBO] Re: About a change in IBC_DATE.IMP |
---|---|
Author | Jason Wharton |
Post date | 2002-09-10T16:21:58Z |
Was there a consensus on this in the community?
Thanks,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
-- We may not have it all together --
-- But together we have it all --
Thanks,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
-- We may not have it all together --
-- But together we have it all --
----- Original Message -----
From: "fabiobot" <fabiobot@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, August 27, 2002 5:39 PM
Subject: [IBO] Re: About a change in IBC_DATE.IMP
> Hi Marco,
>
> Thanks for your answer.
>
> The autofill property really auto-complete the century internally,
> but i would like display the century for the user also if the
> ShotDateFormat year is 'yyyy'.
>
> With AutoFill=True the user enter with:
> 01/08/2 remains 01/08/2 but internally it is 01/08/2002.
> (it's very correct.)
>
> The small change that i wrote is to display the year with four
> digits for the user.
>
> With this change, the user enter with:
> 01/08/2 is changed to 01/08/2002 and the user will see this change.
>
> Best Regards,
>
> Fabio R. Bot
>
> --- In IBObjects@y..., "mmenaz" <mmenaz@l...> wrote:
> > Well, just some thoughts:
> > a) I was thinking about this problem in the past, and my
> conclusion was to try to add a "UnboundDisplayFormat" property (if I
> recall correctly, I had problems naming it simply "displayformat").
> I don't like adding properties in an already rich set (<g>), but
> that seemd to be the most powerful way. I do love controls that work
> unbound too.
> > b) have you enabled and tested the "AutoFill" property? It does
> the "auto-complete" part of your improvement
> >
> > Final: you don't need any permission from the list, but is
> sometime very good, as you are doing, ask about impact and
> acceptance your planned changes can have. I did some improvements to
> that component, and it's incredible the different way it's used /
> locale date conventions / input standards. What was for me "the
> obvious fabolous improvement" (autofill), was a nightmare for some.
> So I had to introduce the autofill flag, and set it's default to
> False :)
> > You could also upload the changed source on the list "files"
> section for some test, but my changes were no tested I suspect,
> until introduced in the IBO standard release... and was too late.
> > But welcome in the IBO source improvements world. It's a fabolous
> set of components, and Jason is really open for improvements
> inclusion. You will sure love it.
> > regards
> > Marco Menardi
> > btw, one of the big "guru" for components here is Geoff Worboys,
> the author of the Enhanced set
> (http://www.telesiscomputing.com.au/enhcomp.htm)
> >
> > --- In IBObjects@y..., "fabiobot" <fabiobot@y...> wrote:
> > > Hi,
> > >
> > > Using IB_DATE as an bound control i can change DisplayFormat
> > > property to something like "dd/mm/yyyy" to see the century (year
> > > with four digits).
> > >
> > > The problem is using IB_DATE as an unbound control, when i don't
> > > have DisplayFormat because it's a field property but i would
> like to
> > > see the year with four digits.
> > >
> > > With a small change this problem is corrected.
> > >
> > > I wrote a small change in IBC_DATE.IMP that will auto-complete
> the
> > > century if ShortDateFormat year is 'yyyy' (year with century).
> > > By example, if the user enter with:
> > >
> > > '08/19/' or '08/19/2' or '08/19/02' => will be changed
> > > to '08/19/2002' and the user will see this change.
> > >
> > > Always the current year is used in this conversion.
> > >
> > > I would like to obtain permission from the list
> > > to send this change to Jason Wharton.
> > > Somebody does not want this change?
> > >
> > > Thanks to all,
> > >
> > > Fabio R. Bot Silva.
> > > -------------------------------------
> > >
> > >
> > > The change is only in ValidateEdit procedure from IBC_DATE.IMP,
> > > see the code below (already is tested).
> > >
> > > {$IFDEF IBO_VCL40_OR_GREATER}
> > > procedure TIB_CustomDate.ValidateEdit;
> > > var
> > > tmpStr, S: string;
> > > I :Integer;
> > > begin
> > > tmpStr := FormatMaskText( EditMask, '' );
> > > if Text <> tmpStr then
> > > begin
> > > S := AnsiLowerCase(ShortDateFormat);
> > > if (Copy(S, Length(S) -3, 4) = 'yyyy') and
> > > (Length(Text) = Length(S)) then
> > > begin
> > > I := 4 - Length(Trim(Copy(Text, 7, 4)));
> > > if I > 0 then
> > > Text := Copy(Text, 1, 6) + Copy(DateToStr(Date), 7,
> I) +
> > > Copy(Text, 7, 4 - I);
> > > end;
> > >
> > > if not Assigned( Field ) then
> > > try
> > > StrToDate( Text );
> > > except
> > > if CanFocus then
> > > SetFocus;
> > > Raise;
> > > end;
> > > end;
> > >
> > > inherited ValidateEdit;
> > > end;
> > > {$ENDIF}