Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to modify StringGrid->ColumnCount in XE10 for Android system



Permlink Replies: 4 - Last Post: Feb 17, 2016 9:49 AM Last Post By: Xavier Yang
Xavier Yang

Posts: 17
Registered: 6/28/02
How to modify StringGrid->ColumnCount in XE10 for Android system
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 29, 2016 9:45 PM
Hello everyone,
I am migrating one Win32 (XE10) appli to Android platform.
I have realized one issue about StringGrid->ColCount;
In XE10 Android, I have to use StringGrid->ColumnCount instead of StringGrid->ColCount.
OK to get this value, but I can't modify StringGrid->ColumnCount!
How to modify it?

Thank in advance
Xavier
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to modify StringGrid->ColumnCount in XE10 for Android system
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 30, 2016 3:43 PM   in response to: Xavier Yang in response to: Xavier Yang
Xavier wrote:

In XE10 Android, I have to use StringGrid->ColumnCount instead
of StringGrid->ColCount.

That means you are migrating from VCL to FireMonkey. Two completely different
frameworks, two completely different methodologies, two completely different
and unrelated TStringGrid components.

OK to get this value, but I can't modify StringGrid->ColumnCount!
How to modify it?

You cannot. It is a read-only property, per the documentation:

http://docwiki.embarcadero.com/Libraries/en/FMX.Grid.TCustomGrid.ColumnCount

The columns are physical TColumn objects in the grid's list of Children objects:

http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.Children

So, if you want to change the number of columns, you have to manipulate the
TColumn objects accordngly. You can add new TColumn objects using the grid's
AddObject() method, and you can remove TColumn objects using the grid's RemoveObject()
method (or better, by freeing/disposing the TColumn objects and letting them
remove themselves):

http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.AddObject

http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.RemoveObject

You should read this for more information:

TStringGrid - FireMonkey Guide


--
Remy Lebeau (TeamB)
Xavier Yang

Posts: 17
Registered: 6/28/02
Re: How to modify StringGrid->ColumnCount in XE10 for Android system
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 1, 2016 9:10 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank you for detail explication. I try to learn the FireMonley concept.
If I understand, in FMX.Grid, there is no equivalent StringGrid used as a simple data table to show a block of data with variable dimension (Row and Col).
BR
Xavier

Remy Lebeau (TeamB) wrote:
Xavier wrote:

In XE10 Android, I have to use StringGrid->ColumnCount instead
of StringGrid->ColCount.

That means you are migrating from VCL to FireMonkey. Two completely different
frameworks, two completely different methodologies, two completely different
and unrelated TStringGrid components.

OK to get this value, but I can't modify StringGrid->ColumnCount!
How to modify it?

You cannot. It is a read-only property, per the documentation:

http://docwiki.embarcadero.com/Libraries/en/FMX.Grid.TCustomGrid.ColumnCount

The columns are physical TColumn objects in the grid's list of Children objects:

http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.Children

So, if you want to change the number of columns, you have to manipulate the
TColumn objects accordngly. You can add new TColumn objects using the grid's
AddObject() method, and you can remove TColumn objects using the grid's RemoveObject()
method (or better, by freeing/disposing the TColumn objects and letting them
remove themselves):

http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.AddObject

http://docwiki.embarcadero.com/Libraries/en/FMX.Types.TFmxObject.RemoveObject

You should read this for more information:

TStringGrid - FireMonkey Guide


--
Remy Lebeau (TeamB)
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to modify StringGrid->ColumnCount in XE10 for Android system
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 2, 2016 8:16 AM   in response to: Xavier Yang in response to: Xavier Yang
Xavier wrote:

If I understand, in FMX.Grid, there is no equivalent StringGrid used
as a simple data table to show a block of data with variable dimension
(Row and Col).

Not true. There is TStringGrid, it just has a different setup than VCL's
TStringGrid. FMX also has its own flavor of TListView, which can display
columned data as well.

--
Remy Lebeau (TeamB)
Xavier Yang

Posts: 17
Registered: 6/28/02
Re: How to modify StringGrid->ColumnCount in XE10 for Android system
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 17, 2016 9:49 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hello,
Thanks your help, I have made my first appli of StringGrid in Android to show a data table.
I have one more question in showing value in the first row of StringGrid.
I'd like to show data name as
StringGrid2->Cells[0][0] = "Time(s)";
StringGrid2->Cells[1][0] = "Values(V)";


Result: these two names have been shown on the second row (in VCL, they are always in the first row !).
I realized that the data were displayed on the first row of StringColumn in FireMonkey.
My question: how to show them in the first row of StringGrid?

Thank you very much.
Xavier


Remy Lebeau (TeamB) wrote:
Xavier wrote:

If I understand, in FMX.Grid, there is no equivalent StringGrid used
as a simple data table to show a block of data with variable dimension
(Row and Col).

Not true. There is TStringGrid, it just has a different setup than VCL's
TStringGrid. FMX also has its own flavor of TListView, which can display
columned data as well.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02