Subject Re: [IBO] Re: IB_Date.NormalCellColor
Author Jason Wharton
I'm pretty well confused by all the IB_Date changes in the air lately.
Let me get out the next sub-release and then please come back at me with any
of your recommendations.

Thanks,
Jason

----- Original Message -----
From: "mmenaz" <mmenaz@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, May 02, 2002 5:21 PM
Subject: [IBO] Re: IB_Date.NormalCellColor


> --- In IBObjects@y..., guido.klapperich@t... wrote:
> > > Could you please tell me why a pain? Maybe do you have to enter more
numbers? I dubt. You are from Italy
> >
> > No I'm from germany, I have only a italian name.
> >
>
> Ops... :) But the date format is the same, I suppose (dd/mm/yy)
>
> [cut]
>
> > But when the field is empty, it sets the date to 03.05.2002 and when I
enter 5.5.99 the result will be 53.55.9902.
>
> Oh, yes, it's a bug I've fixed but Jason has some difficoult to provide a
D3-D6 solution, since my code is for D5-D6. Anyway, if you define an input
mask with 2 years digit it's fine.
> You can also add the following code to fix it (or, replace the procedure
with this):
>
> procedure TIB_CustomDate.KeyPress(var Key: Char);
> var
> strTmp, T: string;
> begin
> // special keys for simplified date entry
> if (not Assigned( Field )) or (Assigned( Field ) and (DataLink.Modify))
then // check if update possible
> begin
> if (Key = char(VK_SPACE)) or
> (((Text = FormatMaskText( EditMask, '' )) or (EditText = SelText))
and (Key in [ '0'..'9' ])) then
> begin
> strTmp := AnsiLowerCase(ShortDateFormat);
> if (length(strTmp)>=4) and (copy(strTmp, length(strTmp)-3,
4)='yyyy') then // try to convert to a 2 digit year
> begin
> replace_string( strTmp, 'yyyy', 'yy' );
> DateTimeToString( T, strTmp, Date );
> strTmp := PadInputLiterals(EditMask, T, ' ');
> if (length(strTmp)>4) and (copy(strTmp, length(strTmp)-3, 2)= '
') then // like: xx/xx/__yy
> Text := T + ' '
> else
> Text := T;
> end
> else
> Text := DateToStr( Date );
>
> // assigning text makes unnecessary to explicitly reflect changes
> // i.e. Modified:=True; DataLink.ControlIsModified:=True; if Key =
char(VK_SPACE) then SysUpdateData( Field );
>
> if Key = char(VK_SPACE) then
> Key := #0;
> end;
> end;
> if not Assigned( Field ) then
> begin
> if not (Key in [ #0..#32, '0'..'9', DateSeparator ]) then
> begin
> MessageBeep(0);
> Key := #0;
> end;
> end;
> inherited KeyPress(Key);
> end;
>
>
> >
> > But more important to me is the problme with NormalCellColor. Do have an
idea, what I have to do to get it work ?
> >
> >
>
> It does not work (bug), because, strange, assigning Brush.Style := bsClear
also reverts the Brush.Color to white. But NormalCellColor I think is not a
great looking property, it should be replaced, I think, with
BackgroundCalendarColor (that seems not implemented yet, but it's late night
here ;)).
> Just to test how it could work if fixed, try this:
> In DatePick.Pas, (internal) procedure PaintCells, around line 1927, you
find code like this:
>
> InflateRect(rCell, -FIncCellWidth, -FIncCellHeight);
> Brush.Style := bsClear;
> Brush.Color := NormalCellColor; // ************************
> DrawText(Handle, PChar(sDate), Length(sDate), rCell,
> DT_SINGLELINE or DT_RIGHT or DT_VCENTER);
>
>
> the line with // ********** it's what you have to add to experiment.
> Let me know
> Marco Menardi
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>