[Lazarus] TPageControl bug (or by desing)?

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sat Sep 17 19:12:00 CEST 2011


It looks a bug. It should be n in onchanging but n-1 in onchange. But it
would be good to confirm in Delphi.
On Sep 17, 2011 6:00 PM, "Bart" <bartjunk64 at gmail.com> wrote:
> 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?
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110917/018e50e5/attachment-0003.html>


More information about the Lazarus mailing list