Ok, I found a work-around for now - though not ideal!  I have to get
the ComponentState as the first thing, so that when I destroy the
form, the 'other stuff' doesn't get executed.


procedure TLearnerListForm.IndexTabControlChange(Sender: TObject);
begin
 if csDestroying in ComponentState then
   exit; //==>
 <.... do other stuff...>
end;

Regards,
 - Graeme -


On 11/30/06, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote:
Hi,

After quite some time debugging my code, I found a very weird bug (I
believe) in the LCL's TTabControl.

Could someone confirm this.  If so, I'll add it to Mantis. See attached project.

I have a TTabControl with 4 Tabs and a OnChange event that writes to
the console to say that the event fired.

Test 1:
  Run the app and exit, without clicking any tabs.  The OnChange event
fires when it shouldn't!   Delphi doesn't fire any OnChange event.

Test 2;
  The weird one, or should I say the correct one.  Run the app and
click the second tab.  OnChange fires, as expected.  Close the app
and no OnChange fires, which is correct behaviour.

Test 3:
  Run the app and click on the 3rd tab. OnChange fires as expected.
Close the app and OnChange fires again.  Not expected.

Test 4:
  The same as test 3, but just click the 4th tab.


Conclusion:
  If the last tab select was the 2nd tab, everything works fine.  The
the last select tab is anything but the 2nd tab, the OnChange event
fires for no reason, when the form is unloaded / freed.

If not a fix, has anybody got a work-around for this.  It caused AV's
in my app, because I have lots of code in my OnChange event.



--
Graeme Geldenhuys
Location: S 34° 03.168'  E018° 49.342'
http://tinyurl.com/y6lc26

There's no place like 127.0.0.1


_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to