Subject [IBO] Re: IB_DATE
Author mmenaz
Unfortunatly, you are wrong. And even if you were right, when unbound the things get a bit more complicated... first of all, you have to store the control value somewhere, since now it interpretes the Text that is always compliant with the edit mask, but with a DisplayFormat it could be impossible to do so.
So the control should:
- store the control value somewhere (FValue?)
- store DisplayFormat somewhere (FDisplayFormat?)
- store EditMask somewhere (FEditMask?)
a) When the control is entered, set EditMask and assign the soted value to Text (but I don't know how, since you should adapt thext to edit mask, see the problem with 2 or 4 digit year format. We could suppose that possible edit mask are only with 2 or 4 final year, no strange combinations allowed)
b) when you leave the control, set the internal date storage (StrToDate(Text)), clear the editmask, set text using the displayformat
I could try to implement this (you know, I'm a unbound IB_Date fan ;)), but I need some help for the a) step, maybe with code/logic taken from the data bound part.
What do you think?
Marco Menardi

(btw, the easy stuff: to just have a different edit mask, publish EditMask, and change in IBC_Edit.IMP
procedure TIB_CustomDate.UpdateMask( UnboundMask: string );
if (not Assigned( Field )) and (UnboundMask = '') then
if EditMask <> '' then
UnboundMask := EditMask
UnboundMask := '!99' + DateSeparator + '99' + DateSeparator + '9999;1; ';
inherited UpdateMask( UnboundMask );

to assign a different editmask you have to do something like:
IB_Date1.Text := ''; // needed if the Text is not empty
IB_Date1.EditMask := '!99/99/99';

--- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> If I'm not mistaken, the properties should be available at runtime. Perhaps
> they could be made public if they are protected.
> Jason Wharton
> CPS - Mesa AZ
> ----- Original Message -----
> From: "mmenaz" <mmenaz@l...>
> To: <IBObjects@y...>
> Sent: Friday, May 10, 2002 8:25 AM
> Subject: [IBO] Re: IB_DATE
> > When Unbound, IB_Date provides a fixed edit mask (!99/99/9999) and no
> displayformat (uses the short date format, as long as I understand).
> > So you can not change this, since there are no related properties.
> > As far as I can understand, IB_Date was developed to be bound, and has
> been made some adjustments to let it's usage unbound, but this aspect was
> not be pushed very much.
> > I think that it would worth the trouble adding some unbound properties to
> it, since I use it unbound quite often (and I would like to have
> unbound/bound behave the same).
> > Just some thoughts...
> > Regards
> > Marco Menardi
> >
> > --- In IBObjects@y..., "fabiobot" <fabiobot@y...> wrote:
> > > Sorry but, i can't set field DisplayForm or EditMask because i'm
> > > using IB_DATE as an unbound control. (without datasource connection).
> > >
> > > How are the means for unbound IB_DATE?
> > >
> > > Thanks,