I have a dataview grid loaded with data on demand, on Windows 10.
The grid get the data from an array.
I want to change some data in the grid, how do I refresh the grid properly?
I changed the value in the arrayx, and called various functions like Redraw, Refresh, InvalidateRow etc., but all end up with the same result, the text is not displayed properly anymore as seen in the picture below.
What am I doing wrong?
How are you adding the data? There are several approaches you could take. Are you using the RowWillRender event to copy the data? or using a DataSource subclass to use the array as storage.
I am using the RowWillRender event.
I’ll assume you’re following from the demo project.
If you’re doing something like this:
Be sure to check that you’re assigning a new value to the cell. Something like:
if me.cellValue(index,0)<>arrayx(index) then me.cell(index,0)=arrayx(index)
The reason for this is an issue I discovered where you could end up with an infinite refresh loop. I’ve added code to avoid the issue in the next update.
The RowWillRender event should be called after InvalidateRow when the view is ready to display the row. If it is not firing then there may be something else going on.
The RowWillRender event ist firing fine when I call Redraw() or Refresh() etc., just the font is bad, as seen in my picture. Something is not 100% refreshed, because when I move the Window via mouse outside the Desktop and back, it refresh properly.
I have to use the RowWillRender on demand thing, because I have array with sometime 5mio. or 10mio. urls in it. I cant set them directly in the grid.
Ok, I see. What scale factor is your system using?
Because its a 4k monitor, I set Windows to 175%
Strange is, when I load the array and set the grid rows to the number of array entries, all entries are correct displayed the first time, but modifying rows will lead to this strange font issue after that.
For example, I load 10 urls into the array, and all are correct displayed after I set the linecount to 10 what triggers the RowWillRender event. After that, when I modify for example the text in the 3rd. row and call Redraw, or Refresh, or set linecount, the font is bad.
I noticed that this issue vanish when I turn HighDPi off (but then all is blurry)