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
docking IDE
by
Paolo
[
Today
at 09:34:57 pm]
Error when opening a proj...
by
Tomu
[
Today
at 09:11:54 pm]
Is this safe, changing fr...
by
mas steindorff
[
Today
at 08:46:31 pm]
TPeriodicTable
by
wp
[
Today
at 08:00:38 pm]
Windows 2026_7 update and...
by
Martin_fr
[
Today
at 07:46:38 pm]
try/except error
by
toby
[
Today
at 06:55:42 pm]
KOL4 Beta available.
by
schuler
[
Today
at 06:34:34 pm]
Putting a new file on a w...
by
J-G
[
Today
at 06:24:49 pm]
Engineering Software from...
by
Thaddy
[
Today
at 05:54:50 pm]
How to connect to MariaDb...
by
Thaddy
[
Today
at 05:51:17 pm]
GTK3 is now the default w...
by
zeljko
[
Today
at 03:40:04 pm]
Computers sure have come ...
by
Zvoni
[
Today
at 03:36:38 pm]
KOL x64
by
Thaddy
[
Today
at 02:06:48 pm]
Install new .deb over exi...
by
dbannon
[
Today
at 01:45:27 pm]
FastCGI vs. CGI
by
egsuh
[
Today
at 12:45:05 pm]
Many recent books on Laza...
by
Thaddy
[
Today
at 08:47:32 am]
Difference between @ and ...
by
DavidTh30
[
Today
at 07:58:00 am]
Isn’t this funny?
by
Joanna
[
Today
at 12:04:29 am]
Slow app start on M5 MacB...
by
Thaddy
[July 15, 2026, 03:36:57 pm]
Solpage
by
munair
[July 15, 2026, 01:47:30 pm]
Need help with fphttpserv...
by
Thaddy
[July 15, 2026, 12:58:30 pm]
Freepascal
by
Thaddy
[July 15, 2026, 12:39:23 pm]
Lazarus interface to Rexx...
by
Thaddy
[July 15, 2026, 12:38:10 pm]
Parsing error?
by
Thaddy
[July 15, 2026, 12:02:02 pm]
is there PDS reader/expor...
by
cdbc
[July 15, 2026, 10:55:30 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Is there a way to take the Text of an specific cell from a TString? (Read 2472 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: 7832
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: 4217
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: 7832
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: 4217
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: 7832
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: 5557
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