Jump to content


Photo

Bug: NxCellClasses


  • Please log in to reply
10 replies to this topic

#1 DiGi

DiGi
  • Members
  • 25 posts
  • Location:in the middle of nowhere

Posted 20 May 2009 - 12:19 PM

Bug in new version - setter SetAsDateTime should not trim TIME part from TDateTime.
www.qr.cz - news 4 u

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 May 2009 - 02:19 PM

Hello Digi,

Nothing have changed in this procedure since version 3.x. Can you please send me small demo project to I see where is a problem and how this procedure should work. Thank you.

Kind regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 DiGi

DiGi
  • Members
  • 25 posts
  • Location:in the middle of nowhere

Posted 20 May 2009 - 02:44 PM

I'm not sure - Diff from SubVersion server:

Revision 5592: Update to NextSuite v4.5.09.1
Revision 5591: NextGrid Suite v4.7.8.1


Index: NxCellClasses.pas
===================================================================
--- NxCellClasses.pas (revision 5591)
+++ NxCellClasses.pas (revision 5592)
@@ -217,7 +217,7 @@

function TDateTimeCell.GetAsInteger: Integer;
begin
- Result := Round(FValue);
+ Result := Trunc(FValue);
end;

function TDateTimeCell.GetAsString: WideString;
@@ -233,7 +233,7 @@

procedure TDateTimeCell.SetAsDateTime(const Value: TDateTime);
begin
- FValue := Value;
+ FValue := Trunc(Value);
inherited;
end;

www.qr.cz - news 4 u

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 May 2009 - 02:47 PM

Hello Digi,

I didn't remember why I have change it. I will need to think a little bit about returning Round instead of trunc.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 May 2009 - 04:15 PM

Hello Digi,

I don't know what to do. Since it is a DateColumn, it is more suitable that it accept only Date part of TDateTime.

I may add for you a switch ($IFDEF) which you may set and column will work as in version 4.7.8.1

Please tell me what you think.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#6 DiGi

DiGi
  • Members
  • 25 posts
  • Location:in the middle of nowhere

Posted 20 May 2009 - 04:31 PM

Oh, i missed that... Simple DateTime column can be fine, just with this one modification. Using two columns as date AND time is now waste of space...

Date column works fine until this update.
www.qr.cz - news 4 u

#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 May 2009 - 04:40 PM

Hello Digi,

I have change this since one year ago upon a requests. Please tell me if is ok to I add one switch for you which you may change and for you DateColumn will work as before.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#8 DiGi

DiGi
  • Members
  • 25 posts
  • Location:in the middle of nowhere

Posted 20 May 2009 - 04:46 PM

It it simple to "cut" time part just by using FormatMask in TNxDateColumn.

Cell is "TDateTimeCell" so it should handle time part too. It it possible to insert Time part using AsFloat (for now ;-)), but I'm not sure that it is correct.

New property AsDate with Trunc is in my opinion better than modify old and correct behavior.
www.qr.cz - news 4 u

#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 May 2009 - 08:02 PM

Hello Digi,

I will need to think a little bit more. Maybe you are correct.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#10 vhorky

vhorky
  • Members
  • 5 posts
  • Gender:Male
  • Location:Czech republic

Posted 23 May 2009 - 07:19 PM

QUOTE (DiGi @ May 20 2009, 03:44 PM) <{POST_SNAPBACK}>
I'm not sure - Diff from SubVersion server:

Revision 5592: Update to NextSuite v4.5.09.1
Revision 5591: NextGrid Suite v4.7.8.1


Index: NxCellClasses.pas
===================================================================
--- NxCellClasses.pas (revision 5591)
+++ NxCellClasses.pas (revision 5592)
@@ -217,7 +217,7 @@

function TDateTimeCell.GetAsInteger: Integer;
begin
- Result := Round(FValue);
+ Result := Trunc(FValue);
end;

function TDateTimeCell.GetAsString: WideString;
@@ -233,7 +233,7 @@

procedure TDateTimeCell.SetAsDateTime(const Value: TDateTime);
begin
- FValue := Value;
+ FValue := Trunc(Value);
inherited;
end;


Hi Digi and Boki,
I have the same problem with using this type of column. I think it is better to use only FValue := Value instead of FValue = Trunc(Value), because the format of datetime "dd.MM.yyy HH:mm:ss" does not work correctly and I must use 2 columns (DateTime and Time). This is not good for reports etc.


#11 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 23 May 2009 - 08:23 PM

Hello vhorky and DiGi. I will think once more and decide what to do. I hope that someone else will write on this topic too.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users