[Lazarus] TCombobox major failure :(

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jul 21 23:34:17 CEST 2008

On Sat, 19 Jul 2008 23:05:43 -0300
Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:

> Mattias Gaertner wrote:
> >> Luiz Americo Pereira Camara wrote:
> >>     
> >>
> >> Gtk2 is handled in an different callback function. Unlike gtk1 the 
> >> LM_SELCHANGE message is sent inside the 'changed' event. At first
> >> look is not possible to determine if the changed event came from
> >> the selection list or not.
> >>
> >> One issue is that in gtk2 and Qt the LM_CHANGED message is sent
> >> before LM_SELCHANGE unlike gtk1, but gtk1 could be reimplemented
> >> like gtk2. Under Win32 is easy to sent an extra LM_CHANGED message
> >> in response to selection change
> >>     
> >
> > It seems, there are no objections. Will you do it?
> >   
> Done.
> The attached patches does the following:

Thanks. Applied.

> - [ComboBox] OnChange is called if a item is selected (just before
> OnSelect)
> - [List/ComboBox] Fix calling OnChange/Select after calls to 
> delete/clear in gtk1/2
> - [ListBox] Fix double call to SelectionChange after setting
> ItemIndex (gtk2)
> - [ComboBox] After Delete ItemIndex is -1 and Text is '' gtk1/2
> - [ComboBox] Fix a bug that was returning previous text set through
> Text when Style is DropDownList (GetText was returning false)
> Implementation details:
> - Under gtk1 all event handling is done inside the 'changed' event 
> handler of the entry widget like gtk2. This event handler is now 
> separated from the generic one. The event handler of 'select' was 
> deleted. It also caches the LCL Index like gtk2 does.
> - Under gtk2, the initial idea was to keep the current approach of
> using WidgetInfo.UserData as a flag to skip unneeded event trigger,
> but since ListBox already uses UserData (ScrollingData) was necessary
> to move the skip logic to the ChangeLock field. The UserData of
> ComboBox now holds the LCLIndex cache.
> - ListBox.CreateHandle calls Assign that calls Clear, so there's no 
> widgetinfo at this time. I added a check to widgetinfo. No big issue 
> here, but i added some options in the comments near of it to remove
> the check.

This creates a circle and the LCL warns about that:
[WARNING] Recursive call to CreateWnd for ComboBox1:TComboBox while
creating handle

Did you not see this warning?

I fixed that. Please review. 15831.

> Some notes:
>  - ComboBox functions in LCLProc can be moved to the WS* classes
> since they are not shared between gtk1/2. I did not do this to keep
> the patch smaller.
>  - I did not touched Qt. Some work needs to be done there.
>  - Together with the patches are the apps i used to test


More information about the Lazarus mailing list