Hi,
If I have a NextGrid placed into my form is it possible to have a reference or a pointer to some fixed, known cells in the table. For example how I could access nextGrid1.Cells[0, 1] through pointer, something like
Pointer := SomeFunction(nextGrid1.Cells[0, 1]);
myStr := TPointerToNextGridCells(Pointer)^;
I managed to get it working through RTTI but it's too slowly if I have to update multiple cells frequently.
Thank you
Best regards,
Luben
Pointer or reference to NextGrid.Cells[..] property
Started by Luben, Nov 25 2012 07:36 PM
4 replies to this topic
#1
Posted 25 November 2012 - 07:36 PM
#2
Posted 25 November 2012 - 08:47 PM
Hello,
Maybe you can use ObjectReference property of each Cell?
Maybe you can use ObjectReference property of each Cell?
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.
--
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
Posted 26 November 2012 - 07:45 AM
Hi Boki,
Thank you, I was not aware of such property for the Cell.
As I see the ObjectReference is type TObject, i.e. it can point virtually to anything.
Now the question is - if I have to change some cell value how can I typecast this Cell object? Cell is property from type NextGrid class so I can't do something
If I have to typecast it to TNextGrid then I need to supply also aCol and aRow.
I guess it needs in NextGrid component some type of reference to function that can get / set the property.
Best regards,
Luben
Thank you, I was not aware of such property for the Cell.
As I see the ObjectReference is type TObject, i.e. it can point virtually to anything.
p : TObject; .... p := NextGrid1.Cell[2, 3].ObjectReference;
Now the question is - if I have to change some cell value how can I typecast this Cell object? Cell is property from type NextGrid class so I can't do something
TCell(p).AsInteger := 2;.
If I have to typecast it to TNextGrid then I need to supply also aCol and aRow.
I guess it needs in NextGrid component some type of reference to function that can get / set the property.
Best regards,
Luben
#4
Posted 28 November 2012 - 11:40 AM
Luben,
Another option is below;
Regards,
Dan.
Another option is below;
procedure TForm1.Button1Click(Sender: TObject); var myCell: TCell; begin myCell := TCell.Create(nil); myCell := NextGrid1.Cell[0,0]; myCell.AsString := 'Hello'; end;
Regards,
Dan.
#5
Posted 28 November 2012 - 08:13 PM
Hi Dan,
Thank you for the proposal.
What you show is a way to dynamically create TCell and to display something. My question was different - how to get pointer to this "AsString" property.
Best regards,
Luben
Thank you for the proposal.
What you show is a way to dynamically create TCell and to display something. My question was different - how to get pointer to this "AsString" property.
Best regards,
Luben
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users