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

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


You must use the Data event to fill the grid (also true for other similar
controls). Draw is for drawing.

Jussi

On Tue, Nov 19, 2024 at 9:09 PM 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 ?Bruce Steers <bsteers4@xxxxxxxxx>
References:
Why does the GridView fire the Draw Event continuously ?Claus Dietrich <claus.dietrich@xxxxxxxxxx>