[lazarus] One more cool little bug died

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Oct 8 18:39:17 EDT 2002


On 08 Oct 2002 13:54:07 -0500
Tony Maro <tonym at nlisc.com> wrote:

> On Tue, 2002-10-08 at 12:31, Mattias Gaertner wrote:
> 
> > > When I try to create all my controls in the OnCreate event of my form,
> > > half of them won't display, half display wrong, and the runtime
> > > generated menus are completely scrambled with huge spaces between
> > > entries and the order all wrong.  The same code placed in the OnShow
> > > event of the same form works just fine.
> > 
> > Plz don't send me an example or else the cool little bug will die.
> > 
> 
> Hadn't planned on it <<BG>>.
> 
> Seriously though, if you WANT the source I've posted it.

Oh no. I warned you. 
Rest in peace little bug. Tony will never forget you ... or at least the cvs ...


I have also repaired Ellipse.


Mattias



>  I'm not sure
> if it happens every time or not but I've definitely seen it.  That's why
> I was kind of wondering if anybody else had seen that happen...  It
> didn't do this on mine until I was creating a lot of components at
> runtime.
> 
> http://members.telocity.com/~tonymaro/cbtracker.bad.tar.gz
> 
> Look in the oncreate and onshow events of the FrmMain (unitmain.pas).  I
> commented out code from it's usual location in the onshow event and
> pasted it into the end of the oncreate event.  Even though it probably
> SHOULD work the net result is quite complex...
> 
> If you compile and run this as is, it will crash with tons of errors
> about invalid parents and the like.  I just realized that.  
> 
> If however you put the code back to normal, run it once, create a new
> checkbook file and exit (so it will auto-load it next time) THEN you run
> the above posted code, it will run (throwing tons of GTK warnings) and
> scrambles things.
> 
> Simply moving the same code from OnCreate to OnShow fixes the issue.  
> 
> OR...
> 
> After painful testing I found that changing the order and creating the
> menus BEFORE the LblAboutTransactions component while in the OnCreate
> event also seems to fix it.  If I create the menus AFTER I create that
> label, the menus are trashed and throw GTK errors everywhere, UNLESS
> it's done in the OnShow event.
> 
> Go figure.
> 
> Like I said, it's pretty complex and I'm not positive there's not some
> aspect of my code interfering, but I don't think so.
> 
> I've seen almost identical problems with placing all the controls on the
> form at design time - that's why I switched to creating at runtime.
> 
> -Tony
> 
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives






More information about the Lazarus mailing list