Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
Is there a way to take the Text of an specific cell from a TString?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
StrToDateTime problems
by
PascalDragon
[
Today
at 09:29:08 pm]
Why does FPC behave this ...
by
PascalDragon
[
Today
at 09:26:24 pm]
How to forward a Class in...
by
PascalDragon
[
Today
at 09:21:47 pm]
Pyramid solitaire, re-wri...
by
TBMan
[
Today
at 09:21:07 pm]
Tzipper giving error on M...
by
Josh
[
Today
at 08:46:02 pm]
Embedded qss stylesheets ...
by
big_M
[
Today
at 08:03:38 pm]
Copy and Past Code
by
n7800
[
Today
at 07:47:43 pm]
AI: Agentic Design Patter...
by
avra
[
Today
at 06:36:29 pm]
[SOLVED] Transparent back...
by
ginoo
[
Today
at 04:08:44 pm]
CudaText editor (written ...
by
szlbz
[
Today
at 02:16:25 pm]
PasLLM - LLM Inference En...
by
matthius
[
Today
at 01:41:45 pm]
Theoretical question. Laz...
by
Petrus Vorster
[
Today
at 01:09:19 pm]
Stacked bars not drawn pr...
by
apeoperaio
[
Today
at 12:57:01 pm]
New book on Object Pascal
by
matthius
[
Today
at 12:55:36 pm]
[SOLVED] Assembler error ...
by
dbannon
[
Today
at 12:55:16 pm]
The compiler fails to war...
by
Martin_fr
[
Today
at 12:44:31 pm]
four squares (inc)
by
speter
[
Today
at 11:25:05 am]
Regarding the issue of de...
by
Martin_fr
[
Today
at 10:20:35 am]
Dice (raylib + kraft phys...
by
fcu
[
Today
at 09:01:24 am]
Lazarus seems to be makin...
by
Boleeman
[
Today
at 07:54:25 am]
[SOLVED] Lazreport PDF
by
Petrus Vorster
[
Today
at 07:42:59 am]
Maze Makers: Modified Cyl...
by
Boleeman
[
Today
at 07:20:10 am]
How to set the Excel cell...
by
dodgex
[
Today
at 04:51:41 am]
TSpeedButton qt6 styleshe...
by
big_M
[January 14, 2026, 04:53:29 pm]
How to prevent onDropFile...
by
Hansaplast
[January 14, 2026, 04:51:23 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Is there a way to take the Text of an specific cell from a TString? (Read 2369 times)
AfootDesert41
New Member
Posts: 15
Is there a way to take the Text of an specific cell from a TString?
«
on:
January 01, 2019, 12:57:20 am »
How do I take the text of an specific cell on a TStringGrid to store it in a variable?
Logged
jamie
Hero Member
Posts: 7486
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #1 on:
January 01, 2019, 01:02:03 am »
Cells [ x,y ]
MyString := Cells [ Column, Row ];
Note:
Fixed cells are part of the indexing..
Oh Wait, you want to take that from a Tstring... Hmmm.
I think that is comma delimited but I would need to check that..
«
Last Edit: January 01, 2019, 01:03:39 am by jamie
»
Logged
The only true wisdom is knowing you know nothing
lucamar
Hero Member
Posts: 4219
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #2 on:
January 01, 2019, 01:02:37 am »
The same way you set them, but
contrarywise
:
Code: Pascal
[Select]
[+]
[-]
MyString
:
=
MyGrid
.
Cells
[
Column
,
Row
]
;
ETA
: Well, Jamie beat me to it
BTW, Happy new year!
«
Last Edit: January 01, 2019, 01:05:33 am by lucamar
»
Logged
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!)
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.
jamie
Hero Member
Posts: 7486
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #3 on:
January 01, 2019, 01:05:53 am »
ah that's it, Rows returns a TstringList so you could just index them as lines.
MyStringList := Grid1.Rows;
MyStringList.Strings[?] = a string of a cell.
«
Last Edit: January 01, 2019, 01:07:43 am by jamie
»
Logged
The only true wisdom is knowing you know nothing
lucamar
Hero Member
Posts: 4219
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #4 on:
January 01, 2019, 01:12:43 am »
Huh? shouldn't it be:
Code: Pascal
[Select]
[+]
[-]
RowStrings
:
=
Grid1
.
Rows
[
Row
]
;
MyString
:
=
RowStrings
[
Column
]
;
?
But knowing the (row,column) coordinates, I would use
Grid.Cells[]
directy; more intuitive.
Logged
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!)
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.
jamie
Hero Member
Posts: 7486
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #5 on:
January 01, 2019, 01:26:06 am »
Yup it should be
Oh Well.. It wouldn't compile that way so they would figure it out!
Logged
The only true wisdom is knowing you know nothing
Handoko
Hero Member
Posts: 5513
My goal: build my own game engine using Lazarus
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #6 on:
January 01, 2019, 08:42:41 am »
@AfootDesert41
Here has a simple demo showing how to load data from TDbf and show it to TStringGrid, change the cells' color and doing searching by reading and comparing the cell content with a search keyword provided by user:
https://forum.lazarus.freepascal.org/index.php/topic,37181.msg249361.html#msg249361
Logged
AfootDesert41
New Member
Posts: 15
Re: Is there a way to take the Text of an specific cell from a TString?
«
Reply #7 on:
January 01, 2019, 09:47:06 am »
Thank you all for your replies!
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Is there a way to take the Text of an specific cell from a TString?
TinyPortal
© 2005-2018