[Lazarus] TPageControl bug (or by desing)?

Bart bartjunk64 at gmail.com
Sat Sep 17 18:00:04 CEST 2011


Hi,

The value of PageCount inside TPageControl.DoChange (and therefore in
the OnChange event) seems wrong (to me), when you remove a page from
the control.

When I have n pages and then remove 1, in DoChange the value of
PageCount still is n, when I would expect it to be n-1 at that moment.
(Tested with Laz r32144).

I stumbled upon this, after hours of digging in entirely the wrong
place <g>, because in my overriden DoChange I called a method that
would check for PageCount > 0 and if so it would access a page.
When I removed the last page, PageCount would still be 1, when in fact
no more pages existed at that time, so any access to
Pages[ActivePageIndex] would crash the program.

Is this really a bug, or is it by design?




More information about the Lazarus mailing list