Recent

Author Topic: StringGrid update question  (Read 341 times)

jbmckim

  • Full Member
  • ***
  • Posts: 144
StringGrid update question
« on: April 16, 2021, 10:07:31 pm »
In stringgrid, is there an event that processes after the grid is updated? I'm using OnPrepareCanvas to color individual cells that have an alarm condition.  I want to reset them from a universal (i.e. whole spreadsheet) reset button.  After updating the cell color, then need to reset the alarm condition boolean to map to the sheet condition.  The problem is the boolean references the entire grid and therefore updating it in OPC necessarily changes the value for all subsequent cells.

Therefore, is there a "Finished Updating Grid" event (or perhaps row).

I couldn't find anything that I recognized as such here:

https://wiki.freepascal.org/Grids_Reference_Page#Description_of_grid.27s_drawing_process

Alternatively, right now, the "reset" function is a button on the host form.  Perhaps if the above is not available there would be another way for the user to signal the app that they want to reset the entire grid?

thanks.


jamie

  • Hero Member
  • *****
  • Posts: 4447
Re: StringGrid update question
« Reply #1 on: April 16, 2021, 11:11:29 pm »
You need to keep a reference elsewhere other than the grid I would think...

Make a change in that reference and force an update...

 MystrnigGrid.Update; or MystringGrid.Repaint or MystringGrid.Invalidate.

one of them should do it.

The only true wisdom is knowing you know nothing

jbmckim

  • Full Member
  • ***
  • Posts: 144
Re: StringGrid update question
« Reply #2 on: April 20, 2021, 01:11:43 am »
Yes but I need 3 parts:

Change variables (used in OnPrepareCanvas to color cells)

Force redisplay. I'm using .invalidate.

Then reset variables again for further processing.  The problem is that I have no visibility into when OnPrepCanv is actually done.

 

TinyPortal © 2005-2018