Forum > LCL

[SOLVED] How to detect if a StringGrid was edited?

(1/1)

Hartmut:
My program has a StringGrid where 2 columns are editable. To know, if I must save changes, I must know, if something was edited. Is there already somekind of Flag for this? Or must I do all this by my own? If yes, what would be the easiest approach?

I use Lazarus 2.0.10 with FPC 3.2.0. Thanks in advance.

Josh:
hi

tstringgrid does have a property you can read/write called modified.

if stringgrid.modified then ???

any change to grid contents will set the property to true, so after you populate your grid you need to set the property to false.

It s very basic, you may be better creating your own code to accomplish the same.
But you never know it may be enough for you.

dsiders:

--- Quote from: Hartmut on December 04, 2023, 07:18:41 pm ---My program has a StringGrid where 2 columns are editable. To know, if I must save changes, I must know, if something was edited. Is there already somekind of Flag for this? Or must I do all this by my own? If yes, what would be the easiest approach?

I use Lazarus 2.0.10 with FPC 3.2.0. Thanks in advance.

--- End quote ---

More recent LCL versions include the Modified property (public). Not sure about your version.

https://lazarus-ccr.sourceforge.io/docs/lcl/grids/tcustomstringgrid.modified.html

jamie:
That property is in 3.0.4 laz of the grid, so I don't think there is any concerns there.

Hartmut:
Many thanks to all for your answers and especially the documentation link. 'TStringGrid.Modified' does exist in Lazarus 2.0.10 and I think this will work for my purpose.

Navigation

[0] Message Index

Go to full version