Jump to content


Photo

Need to have a tCell.asInt64


  • Please log in to reply
4 replies to this topic

#1 didiergm

didiergm
  • Honorable Members
  • 148 posts
  • Gender:Male
  • Location:France

Posted 31 January 2011 - 02:26 PM

I had a look at this and found that


on a tloatcell, it is easy enough to achieve, by adding a getasint64/setasInt64, If I understand correctly this

on a tintegercell, i was originally tempted to change the fvalue datatype from integer to int64, but as i undertand it a tintegercell will only be instantiated if a culumn is an ingage, a reta or a list

Would you consider adding it to the next release, I am happy to send you what I did.

Didier



#2 didiergm

didiergm
  • Honorable Members
  • 148 posts
  • Gender:Male
  • Location:France

Posted 31 January 2011 - 02:59 PM

this is what I did to achieve an asInt64


in NxCells.tCell I added the following property



property asInt64: Int64 read GetAsInt64 write SetasInt64;

function GetAsInt64: int64; virtual; abstract;
procedure SetAsInt64(const Value: Int64); virtual;



procedure TCell.SetAsInt64(const Value: Int64);
begin
Changed;
end;


then in nxCellsClasses I added

function GetAsInt64: int64; virtual; override;
procedure SetAsInt64(const Value: Int64); override;



then for tFloatCell (the only cell type which really needs changing, if I understand correctly)

procedure TFloatCell.setAsInt64 (const value: Int64);
begin
fValue := value;
inherited;
end;


function TFloatCell.GetAsInt64: Int64;
begin
Result := Round(FValue);
end;


and for the others cell types, simply

procedure TxxxxCell.setAsInt64 (const value: Int64);
begin
self.setasInteger(integer(value));
end;


function TxxxxCell.GetAsInt64: Int64;
begin
Result := self.getAsInteger;
end;





#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 February 2011 - 02:27 AM

Hello Didier,

I like to say sorry for delay. I was been in my Birth town for day and a half.

I will need to think about it. Why not use a AsFloat for a moment, until I decide. This may be big decision.

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.

#4 didiergm

didiergm
  • Honorable Members
  • 148 posts
  • Gender:Male
  • Location:France

Posted 05 February 2011 - 10:13 AM

QUOTE (Boki (Berg) @ Feb 4 2011, 02:27 AM) <{POST_SNAPBACK}>
Hello Didier,

I like to say sorry for delay. I was been in my Birth town for day and a half.

I will need to think about it. Why not use a AsFloat for a moment, until I decide. This may be big decision.

Best regards


Don't be sorry, you are allowed to travel smile.gif

the problem with asFloat at the moment is that, if I understand correctly, the underlying property is still an integer ... not an int64, unless I misundestood what you say

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 08 February 2011 - 02:39 AM

Hello Didier,

As far I think, you may use AsFloat and convert it to Int64. You can use all what you write above, but in more external way.

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