[Lazarus] gtk2 notebooks

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Jul 29 01:19:52 CEST 2011


For my attempt to fix the problems in the gtk2 TabControl implementation 
I need some background information. Can anybody help me, or continue my 
started update?

In the first step I try to keep the dummy page, that is created together 
with the notebook widget, and use it for all tabs. I also managed to 
have the associated dummy tab invisible, but at sudden the 
implementation started to behave inconsistenly. Sometimes adding tabs 
(in code) works, but in most cases no tabs are shown at all. Reverting 
the code to the previously working implementation didn't help, so that 
it looks like some random behaviour, as known from uninitialized local 
variables.

Concrete questions:

- What's the purpose of the page widget, required in many gtk_notebook 
procedures?

- How is the page Handle defined and managed?
Is it the address of the associated gtk widget?

In my TabCtrl model I use a dummy LCL page (TCustomPage) to transfer 
parameters to the widgetset. In the Win32 widgetset I could prevent code 
from dealing with a page without an allocated Handle, but this seems to 
cause trouble with gtk2. Since now two dummy pages are used, one in the 
LCL code and one in the gtk2 code, can I assign the "handle" of the gtk2 
dummy page widget to the LCL dummy page? How? Can I simply assign the 
pointer to the page widget to the TCustomPage.Handle?

- How does the gtk2 widgetset determine the ClientRect (of a notebook)?
The reported ClientWidth and ClientHeight look good (smaller than the 
notebook Width and Height), regardless of whether the added tabs are 
shown or invisible. Could it be that the client origin is wrong, i.e. 
the dummy page sits at the topleft of the control and makes the tabs 
invisible?

- When I put an button on a TabCtrl, at design time, that button also is 
visible at runtime, regardless of whether the tabs themselves are shown 
or invisible. This seems to indicate that the dummy page widget is the 
parent of the button.


I can upload the patch with the current state of my gtk2 modifications 
and a test program, that shows both a TPageControl and TNewTabControl 
side by side, for the verification that the modifications do not affect 
the behaviour of the page control.

DoDi




More information about the Lazarus mailing list