[Lazarus] TCombobox major failure :(

Luiz Americo Pereira Camara luizmed at oi.com.br
Sun Jul 20 04:05:43 CEST 2008

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?


The attached patches does the following:

- [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 
- [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 

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 
 - I did not touched Qt. Some work needs to be done there.
 - Together with the patches are the apps i used to test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ComboBoxItemIndex.zip
Type: application/zip
Size: 2761 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080719/74544ea3/attachment-0021.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtkcomboitemindex_patches.zip
Type: application/zip
Size: 7175 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080719/74544ea3/attachment-0022.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ListItemIndex.zip
Type: application/zip
Size: 2501 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080719/74544ea3/attachment-0023.zip>

More information about the Lazarus mailing list