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

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


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

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

> Hi
>
> Today I implemented A GridView in one of my apps and found that it caused
> a CPU load of up to 80%. The App slowed down to an unacceptable level. This
> mini program with a GridView demonstrates it:
> Public Sub Form_Open()
>
>     GridView1.Columns.Count = 1
>     GridView1.Rows.count = 3
>
> End
>
> Public Sub GridView1_Draw(X As Integer, Y As Integer, Width As Integer,
> Height As Integer, Row As Integer, Column As Integer)
>
>   Print Time
>   GridView1[Row, Column].Text = "Hello"
>
> End
>
> It shows, that the draw event is triggered continuously (here about 2.500
> times per second) with a very high CPU load.
>
> This issue was already brought up in the recent ML thread "Data event of
> TableView" a few days ago. I am wondering why this is regarded as "normal".
> Why does the Gridview fire the draw event continuously? This makes no sense
> to me. Is this Draw Event different than Draw Events of other controls?
>
> Best regards
>
> Claus
>
>
>
>
>
>
>
>
>
>
>

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