[lazarus] TNoteBook probems Fixed

Marc Weustink weus at quicknet.nl
Wed Sep 29 19:46:10 EDT 1999


And got lots of others :-)

I can't reach CVS tonight so I might be able to update it tomorrow. (And if
not tomorrow... I'll be on a holliday for 3 weeks)

Basic problem was that a notebook page  already had a notebook as parent.
gtk does not like that.

Modifications: A few
- Removed some debug messages
+ Added some others
* changed fixed widged of TPage. Code is still broken.
+ TWinControls are also added to the Controls collection
+ Added TControl.Controls[] property


Problems:
* The way Owner and Parent are used is not correct. lcl components have
owners. GTK objects have (lcl) parents.

A construction (in say MyForm.Create) like: 
  TButton.Create(Self).Parent := NoteBook1.Page[0];
should create a button on page0. This is however not the case (its created
on MyForm)

* The CreateComponent and AddControl methods shouldn't be used in the way
it is used now. Like ik was in TPage, you get very unpredictable results.
IMHO AddControl should be called after assigning/changing parent. and
Create component the first moment we need a visible/touchable part.

* A control should never be part of its own controls collection. In my
debugmessages I see constructions like:
[TWinControl.Remove] TBUTTON --> Remove: TBUTTON ()
[TWinControl.Insert] TPAGE --> Insert: TBUTTON ()
and it looks like the parent of TBUTTON was TBUTTON itself. 
Something similar: A form has no parent and while looping through the
controls collection, you'll find the form as Controls[0]



Marc








More information about the Lazarus mailing list