[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does the GridView fire the Draw Event continuously ?


On Tue, 19 Nov 2024, 20:37 Claus Dietrich, <claus.dietrich@xxxxxxxxxx>
wrote:

> Am 19.11.24 um 20:31 schrieb Benoît Minisini:
>
> Le 19/11/2024 à 20:13, Bruce Steers a écrit :
>
> By setting .Text it causes a refresh so it recursively loops.
>
> You must not set any properties that would cause a refresh of the control
> in the draw event.
>
> Respects
> BruceS
>
>
> Of course, I didn't read carefully...
>
> This is what I call "something weird"!
>
> It is obvious that is has to do with the filling of a cell. But why is
> this something weird? Why does this cause infinit refreshes?
>
Because what I said.
A Draw happens at Refresh. Setting a  .Text property causes a Refresh.
In the refresh Draw is called again.
In the Draw event .Text is set again.
That causes a refresh again.
And so on...

If I can't do this in the event loop, then why was it provided? What for?
>
Draw event is primarily for Paint operations.

A retrigger of the draw event also doesn't take place at Draw Events of
> other controls and your first intuitiv reaction was like mine.
>
It will if you change a property that triggets a Refresh.

Respects
BruceS

References:
Why does the GridView fire the Draw Event continuously ?Claus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: Why does the GridView fire the Draw Event continuously ?Bruce Steers <bsteers4@xxxxxxxxx>
Re: Why does the GridView fire the Draw Event continuously ?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Why does the GridView fire the Draw Event continuously ?Claus Dietrich <claus.dietrich@xxxxxxxxxx>