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
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
Does anyone have experien...
by
xiyi0616
[
Today
at 03:38:17 am]
The issue of the scroll b...
by
jianwt
[
Today
at 03:27:12 am]
Why does $fpctarget not w...
by
Gustavo 'Gus' Carreno
[
Today
at 03:18:16 am]
"Mario & Luigi" (1994-200...
by
Gustavo 'Gus' Carreno
[
Today
at 01:46:38 am]
TMemoryStream Question wi...
by
Schmitty2005
[
Today
at 01:22:29 am]
GitHub action setup-lazar...
by
Gustavo 'Gus' Carreno
[
Today
at 01:03:07 am]
How to control subform: S...
by
Wilko500
[
Today
at 12:09:23 am]
A minor issue with the TR...
by
cdbc
[July 15, 2025, 11:44:52 pm]
activex.pp DosDateTimeToV...
by
440bx
[July 15, 2025, 11:16:33 pm]
Line Numbers, own System ...
by
Martin_fr
[July 15, 2025, 10:05:31 pm]
use Macro defines with Pa...
by
PascalDragon
[July 15, 2025, 10:03:21 pm]
generic Class for any Typ...
by
PascalDragon
[July 15, 2025, 09:53:18 pm]
Asking for an example of ...
by
marcov
[July 15, 2025, 09:39:58 pm]
Problems with libraries f...
by
regs
[July 15, 2025, 08:23:36 pm]
THUMBBUTTON does not work...
by
ASerge
[July 15, 2025, 08:10:40 pm]
Record Locked
by
Thaddy
[July 15, 2025, 07:28:38 pm]
tSQLQuery.UpdateSQL with ...
by
JRBleau
[July 15, 2025, 07:15:19 pm]
RichMemo's contents heigh...
by
dpap
[July 15, 2025, 06:13:22 pm]
Is Lazarus still serious ...
by
Thaddy
[July 15, 2025, 05:39:02 pm]
How to prevent text to be...
by
CM630
[July 15, 2025, 05:13:13 pm]
Has anyone installed TeeB...
by
Thaddy
[July 15, 2025, 05:04:07 pm]
fpc in [home] folder not ...
by
Gustavo 'Gus' Carreno
[July 15, 2025, 03:54:17 pm]
Setting up an ARM embedde...
by
Ruptor
[July 15, 2025, 03:06:39 pm]
Groupview Partial loading...
by
matthius
[July 15, 2025, 02:37:07 pm]
[Solved]Setting with hori...
by
PeterHu
[July 15, 2025, 12:32:44 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Is there a way to take the Text of an specific cell from a TString? (Read 2285 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: 6995
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: 6995
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: 6995
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: 5458
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