Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-07

TCombobox major failure :(

37 messages · 12 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

In GTK 1, the TCombobox somehow looses the 'OnChange' event after it was fired once, but only when the items list is sorted.

Steps to reproduce:
- Drop TCombobox on a new form
- Set items (one two three four five)
- Set Sorted=True - this is required !!
- Set Style=csDropDownlist (don't know if this is required)
- In OnChange event handler show a message or something like it.
- Run project.
- Select item. Message appears.
- Select another item. Message does not appear.

The event handler is still Nil (I added code to check this), but is simply never called any more when something is selected.

And in GTK 2 the event handler is always called twice !!

Is this a known issue ? I'm using Lazarus revision 15540. Should I add it to the bug tracker ?
Because this is IMHO a major regression...

Michael.

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 27 lines
Zitat von Michael Van Canneyt : > Hi, > > In GTK 1, the TCombobox somehow looses the 'OnChange' event after it was > fired > once, but only when the items list is sorted. > > Steps to reproduce: > - Drop TCombobox on a new form > - Set items (one two three four five) > - Set Sorted=True - this is required !! > - Set Style=csDropDownlist (don't know if this is required) > - In OnChange event handler show a message or something like it. > - Run project. > - Select item. Message appears. > - Select another item. Message does not appear. > > The event handler is still Nil (I added code to check this), > but is simply never called any more when something is selected. > > And in GTK 2 the event handler is always called twice !! The GTK2 sends an LMCHANGED for the change of the edit and an LMSELCHANGE for the change of the ItemIndex. The LCL sends the second OnChange if OnSelect is nil. I don't know why. Maybe the LCL should be extended to not send the change two times?

Yes, because this is not consistent with the other widgetsets, and not consistent with Delphi ?

Show quoted text 7 lines
> Is this a known issue ? I'm using Lazarus revision 15540. > Should I add it to the bug tracker ? > Because this is IMHO a major regression... I will take a would be great.

Michael.

Reply by email

Mattias Gärtner
to Michael Van Canneyt

Zitat von Michael Van Canneyt :

Show quoted text 33 lines
On Wed, 9 Jul 2008, Mattias G??rtner wrote: > Zitat von Michael Van Canneyt : > > > Hi, > > > > In GTK 1, the TCombobox somehow looses the 'OnChange' event after it was > > fired > > once, but only when the items list is sorted. > > > > Steps to reproduce: > > - Drop TCombobox on a new form > > - Set items (one two three four five) > > - Set Sorted=True - this is required !! > > - Set Style=csDropDownlist (don't know if this is required) > > - In OnChange event handler show a message or something like it. > > - Run project. > > - Select item. Message appears. > > - Select another item. Message does not appear. > > > > The event handler is still Nil (I added code to check this), > > but is simply never called any more when something is selected. > > > > And in GTK 2 the event handler is always called twice !! > > The GTK2 sends an LMCHANGED for the change of the edit and an LMSELCHANGE for > the change of the ItemIndex. > The LCL sends the second OnChange if OnSelect is nil. I don't know why. > Maybe the LCL should be extended to not send the change two times? Yes, because this is not consistent with the other widgetsets, and not consistent with Delphi ?

I don't know if the OnChange is wrong or the OnSelectnil test is wrong. gtk1 does not send LMSELCHANGE events, so there the case does not happen.

Show quoted text 7 lines
> > Is this a known issue ? I'm using Lazarus revision 15540. > > Should I add it to the bug tracker ? > > Because this is IMHO a major regression... > > I will take a look at gtk1. Thanks. That would be great.

Please try 15725.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 38 lines
Zitat von Michael Van Canneyt : > On Wed, 9 Jul 2008, Mattias G??rtner wrote: > > > Zitat von Michael Van Canneyt : > > > > > Hi, > > > > > > In GTK 1, the TCombobox somehow looses the 'OnChange' event after it was > > > fired > > > once, but only when the items list is sorted. > > > > > > Steps to reproduce: > > > - Drop TCombobox on a new form > > > - Set items (one two three four five) > > > - Set Sorted=True - this is required !! > > > - Set Style=csDropDownlist (don't know if this is required) > > > - In OnChange event handler show a message or something like it. > > > - Run project. > > > - Select item. Message appears. > > > - Select another item. Message does not appear. > > > > > > The event handler is still Nil (I added code to check this), > > > but is simply never called any more when something is selected. > > > > > > And in GTK 2 the event handler is always called twice !! > > > > The GTK2 sends an LMCHANGED for the change of the edit and an LMSELCHANGE > for > > the change of the ItemIndex. > > The LCL sends the second OnChange if OnSelect is nil. I don't know why. > > Maybe the LCL should be extended to not send the change two times? > > Yes, because this is not consistent with the other widgetsets, and not > consistent with Delphi ? I don't know if the OnChange is wrong or the OnSelectnil test is wrong. gtk1 does not send LMSELCHANGE events, so there the case does not happen.

Hm. In each case, It should never fire an event twice.

Show quoted text 10 lines
> > > Is this a known issue ? I'm using Lazarus revision 15540. > > > Should I add it to the bug tracker ? > > > Because this is IMHO a major regression... > > > > I will take a look at gtk1. > > Thanks. That would be great. Please try 15725.

Works like a charm, thanks for the fix !
Now the Data Desktop works again as designed :-)

Michael.

Reply by email

Ales Katona
to Michael Van Canneyt

Note that while I was investigating gtk2 problem regarding non-working "default" property when a combobox is inside a groupbox, I found out that while the keydown event is emitted by the combobox, the keyup is emitted by the groupbox.

Perhaps there's a connection with the double event reporting?

Just a hunch.

Ales

Reply by email

Mattias Gaertner
to Ales Katona
Show quoted text 6 lines
Note that while I was investigating gtk2 problem regarding non-working "default" property when a combobox is inside a groupbox, I found out that while the keydown event is emitted by the combobox, the keyup is emitted by the groupbox. Perhaps there's a connection with the double event reporting?

I guess not. Because the gtk2 works pretty fine. But the LCL action is somehow wrong. Maybe some windows devels / delphi experts can explain, why the LCL have this strange OnSelect/OnChange logic. Then it can be decided, how to fix the double OnChange.

Mattias

Reply by email

Luiz Americo Pereira Camara
to Mattias Gärtner: Zitat von Michael Van Canneyt : I don't know if the OnChange is wrong or the OnSelectnil…
Mattias G?rtner wrote 21 lines
Zitat von Michael Van Canneyt : > On Wed, 9 Jul 2008, Mattias G??rtner wrote: > > >> Zitat von Michael Van Canneyt : >> >> >> the change of the ItemIndex. >> The LCL sends the second OnChange if OnSelect is nil. I don't know why. >> Maybe the LCL should be extended to not send the change two times? >> > Yes, because this is not consistent with the other widgetsets, and not > consistent with Delphi ? > I don't know if the OnChange is wrong or the OnSelectnil test is wrong. gtk1 does not send LMSELCHANGE events, so there the case does not happen.

The call to OnChange if Select is nil is Delphi compatible. Currently LCL win32 is fully compatible with Delphi regarding this issue.

There's a lengthy bug report about this
(http://bugs.freepascal.org/view.php?id=1495). See comment 0002113 to the Delphi behavior i described.

This bug was fixed some time ago so its a regression. Revising the changes done at that time can lead to the fix (i also provided a patch but Matias used another approach).

Luiz

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 6 lines
Mattias G?rtner wrote: > I don't know if the OnChange is wrong or the OnSelectnil test is wrong. > gtk1 does not send LMSELCHANGE events, so there the case does not happen. > >

Gtk1 still sends LM_SELCHANGE (that is mapped to OnChange at LCL level). Currently it does not send LM_CHANGED by a patch done by you (rev 10767). Maybe this code does not work for gtk2 (or the message is coming for elsewhere). Not sure since i'm on a win32 machine now.

Some info on what all of this is about here:
http://lazarusroad.blogspot.com/2006/12/eliminating-duplicate-events-of.html

Show quoted text 11 lines
The call to OnChange if Select is nil is Delphi compatible. Currently LCL win32 is fully compatible with Delphi regarding this issue. There's a lengthy bug report about this (http://bugs.freepascal.org/view.php?id=1495). See comment 0002113 to the Delphi behavior i described. This bug was fixed some time ago so its a regression. Revising the changes done at that time can lead to the fix (i also provided a patch but Matias used another approach).

Two changes related are at revision 10767 (see above) and 10993 (unlikely to be the cause)

I can take a look at this issue but only in the next Sunday.

Luiz

Reply by email

Mattias Gaertner
to Luiz Americo Pereira Camara
Show quoted text 33 lines
Luiz Americo Pereira Camara wrote: > Mattias G?rtner wrote: > >> I don't know if the OnChange is wrong or the OnSelectnil test is >> wrong. gtk1 does not send LMSELCHANGE events, so there the case >> does not happen. >> >> Gtk1 still sends LM_SELCHANGE (that is mapped to OnChange at LCL level). Currently it does not send LM_CHANGED by a patch done by you (rev 10767). Maybe this code does not work for gtk2 (or the message is coming for elsewhere). Not sure since i'm on a win32 machine now. Some info on what all of this is about here: http://lazarusroad.blogspot.com/2006/12/eliminating-duplicate-events-of.html > The call to OnChange if Select is nil is Delphi compatible. > Currently LCL win32 is fully compatible with Delphi regarding this > issue. > > There's a lengthy bug report about this > (http://bugs.freepascal.org/view.php?id=1495). See comment 0002113 > to the Delphi behavior i described. > > This bug was fixed some time ago so its a regression. Revising the > changes done at that time can lead to the fix (i also provided a > patch but Matias used another approach). > Two changes related are at revision 10767 (see above) and 10993 (unlikely to be the cause) I can take a look at this issue but only in the next Sunday.

I read the thread again and will try to summarize it. Please confirm or correct me:

When the user selects an item via the popup list, then an LM_SELCHANGE event should be fired. OTOH the text changes too, so the LM_CHANGE event makes sense too. But according to Luis the winapi does not send the LM_CHANGE. The VCL follows the winapi and triggers only an OnSelect, but not an OnChange.
I agree with Luis the winapi (and VCL) is somewhat inconsistent here, because you can not use OnChange to follow every change. Luis was fearless enough to write some gtk signal stops to mimic the winapi behavior. I think this sounds too much like emulating the winapi, which is not the goal of the LCL.

My question is:
What about the other widgetsets?
Can they easily distinguish between a popup selection change and other changes?
If not, then we should redefine the LM_CHANGE, LM_SELCHANGE events for the combobox. The TComboBox should be Delphi compatible, the messages don't need to be.
For example: It is quite simple to add a LM_CHANGE in the win32 intf. TComboBox could check before triggering an OnChange if something has changed, which should be quite Delphi compatible.

Mattias

Reply by email

Luiz Americo Pereira Camara
to Mattias Gaertner
Mattias Gaertner wrote 5 lines
I read the thread again and will try to summarize it. Please confirm or correct me: When the user selects an item via the popup list, then an LM_SELCHANGE event should be fired.

Correct. Win32, Gtk1 and Gtk2 does this currently.

OTOH the text changes too, so the LM_CHANGE event makes sense too.

Yes. Works fine in Win32, Gtk1 and Gtk2 (as far as i remenber)

But according to Luis the winapi does not send the LM_CHANGE.

Ok

The VCL follows the winapi and triggers only an OnSelect, but not an OnChange.

Ok. It will map the WM_SELCHANGE to an OnChange event if OnSelect is not is set

I agree with Luis the winapi (and VCL) is somewhat inconsistent here, because you can not use OnChange to follow every change. Luis was fearless enough to write some gtk signal stops to mimic the winapi behavior.

It's my hacker vein in action ;-)

I think this sounds too much like emulating the winapi, which is not the goal of the LCL.

Ok. It's not below.

Show quoted text 8 lines
My question is: What about the other widgetsets? Can they easily distinguish between a popup selection change and other changes? If not, then we should redefine the LM_CHANGE, LM_SELCHANGE events for the combobox. The TComboBox should be Delphi compatible, the messages don't need to be.

One drawback, although unlikely, is if an descendant intercept LM_* messages.

For example: It is quite simple to add a LM_CHANGE in the win32 intf. TComboBox could check before triggering an OnChange if something has changed, which should be quite Delphi compatible.

It's an option. Another option (simpler) is see why the current code to avoid the LM_CHANGED message works for Gtk1 and not for gtk2. See if is possible under detect under gtk2. I'll see.

Luizzzzzzzzzzzzzzz ;-)

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 5 lines
Mattias Gaertner wrote: > My question is: > What about the other widgetsets? >

Qt also sends LM_CHANGED + LM_SELCHANGE

Show quoted text 13 lines
> Can they easily distinguish between a popup selection change and > other changes? > If not, then we should redefine the LM_CHANGE, LM_SELCHANGE events for > the combobox. The TComboBox should be Delphi compatible, the > messages don't need to be. > > One drawback, although unlikely, is if an descendant intercept LM_* messages. > For example: It is quite simple to add a LM_CHANGE in the win32 intf. > TComboBox could check before triggering an OnChange if something has > changed, which should be quite Delphi compatible.

It's the most doable solution . See below.

It's an option. Another option (simpler) is see why the current code to avoid the LM_CHANGED message works for Gtk1 and not for gtk2. See if is possible under detect under gtk2. I'll see.

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

Luiz

Reply by email

Mattias Gaertner
to Luiz Americo Pereira Camara
Show quoted text 39 lines
Luiz Americo Pereira Camara wrote: > Mattias Gaertner wrote: > >> My question is: >> What about the other widgetsets? >> Qt also sends LM_CHANGED + LM_SELCHANGE >> Can they easily distinguish between a popup selection change and >> other changes? >> If not, then we should redefine the LM_CHANGE, LM_SELCHANGE events >> for the combobox. The TComboBox should be Delphi compatible, the >> messages don't need to be. >> >> > One drawback, although unlikely, is if an descendant intercept LM_* > messages. > >> For example: It is quite simple to add a LM_CHANGE in the win32 >> intf. TComboBox could check before triggering an OnChange if >> something has changed, which should be quite Delphi compatible. It's the most doable solution . See below. > It's an option. Another option (simpler) is see why the current > code to avoid the LM_CHANGED message works for Gtk1 and not for > gtk2. See if is possible under detect under gtk2. I'll see. > 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?

Mattias

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara: Yes. Luiz
Luiz Americo Pereira Camara wrote 8 lines
Mattias Gaertner wrote: > It seems, there are no objections. Will you do it? > > Yes.

I managed to get the discussed behavior with Gtk1, Gtk2, Win32, but before submitting a patch i'd like to discuss more two issues found:

- Win32, gtk1, gtk2 does not fires OnChange after Text is changed through code. Qt does. It's possible to get this behavior in these widgetsets. What do you think?
- After an item is deleted the ItemIndex is set to -1 and no event is fired under win32. Under Gtk1, Gtk2, Qt the next item is selected and the OnSelect/Change are fired. What path to follow?

Luiz

Reply by email

Mattias Gaertner
to Luiz Americo Pereira Camara
Show quoted text 16 lines
Luiz Americo Pereira Camara wrote: > Mattias Gaertner wrote: > >> It seems, there are no objections. Will you do it? >> >> > > Yes. > I managed to get the discussed behavior with Gtk1, Gtk2, Win32, but before submitting a patch i'd like to discuss more two issues found: - Win32, gtk1, gtk2 does not fires OnChange after Text is changed through code. Qt does. It's possible to get this behavior in these widgetsets. What do you think?

I think, that would be too Delphi incompatible.

- After an item is deleted the ItemIndex is set to -1 and no event is fired under win32. Under Gtk1, Gtk2, Qt the next item is selected and the OnSelect/Change are fired. What path to follow?

The Delphi way. Unless it is too complicated to implement. But we just need to ignore events during a pascal operation, so it is easy, isn't it?

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote 5 lines
> - Win32, gtk1, gtk2 does not fires OnChange after Text is changed > through code. Qt does. It's possible to get this behavior in these > widgetsets. What do you think? I think, that would be too Delphi incompatible.

I agree. Many developers (components) rely on the fact that you can set properties via code and events will not fire. In some cases, only user interaction should cause the events to fire.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Boian Mitov
to Mattias Gaertner: On Wed, 16 Jul 2008 21:56:59 -0300 I think, that would be too Delphi incompatible. The…

Hi Folks,

Has anybody attempted to create a Lazarus Plasma applet for Linux KDE 4 ? Although the KDE 4 seems to introduce some interesting ideas, it seems to be missing at least 70% of the rudimental features ;-) .

With best regards,
Boian Mitov

-------------------------------------------------------------------- Mitov Software
http://www.mitov.com
--------------------------------------------------------------------

Reply by email

Michael Van Canneyt
to Boian Mitov
Boian Mitov wrote 5 lines
Hi Folks, Has anybody attempted to create a Lazarus Plasma applet for Linux KDE 4 ? Although the KDE 4 seems to introduce some interesting ideas, it seems to be missing at least 70% of the rudimental features ;-) .

Aren't they supposed to be coded at least partially in Javascript ?

Michael.

Reply by email

Funky Beast
to Boian Mitov: Has anybody attempted to create a Lazarus Plasma applet for Linux KDE 4 ? Although the…

Hi,

Boian Mitov wrote
Hi Folks, Has anybody attempted to create a Lazarus Plasma applet for Linux KDE 4 ?

Somebody has to translate and create bindings for the mammoth KDESDK for KDE 4 first. ;-) Plasma is a new framework, thus its in rapid evolution, its too early for production use.

Although the KDE 4 seems to introduce some interesting ideas, it seems to be missing at least 70% of the rudimental features ;-) .

KDE 4 is still at infant stage. It has an extremely ambitious goal to run its frameworks, desktop and window manager in a lot of platforms, even Windows (http://windows.kde.org), MacOS and mobile OSes. Thus it went through major refactoring and reorganizing its frameworks.

Check out overview of KDE 4, its frameworks and roadmap in this interesting video here: http://video.google.com/videoplay?docid=6642148224800885420&hl=en

Personally, I would wait for at least version 4.3 for daily production use.

Regards,
Funky Beast

Reply by email

Boian Mitov
to Funky Beast

Hi Funky,

I agree, I am running it in a VM to evaluate it. I was just curious if somebody has written an applet already. I think the 4.0 is rally not ready even for the most basic tasks, but that is IMHO. I will try to install 4.1 to see how it looks. I have heard it is much better. BTW: I am absolutely new on Linux, but I did the transition to KDE 3.5 in no time, and love it. I hope 4 eventually will mature to similar stage.

With best regards,
Boian Mitov

-------------------------------------------------------------------- Mitov Software
http://www.mitov.com
--------------------------------------------------------------------

Earlier message 10 lines
----- Original Message ----- From: "Funky Beast" To: "Lazarus mailing list" Sent: Thursday, July 17, 2008 7:09 AM Subject: Re: [Lazarus] Lazarus KDE4 Plazma applet > Personally, I would wait for at least version 4.3 for daily production > use. >

Reply by email

Boian Mitov
to Michael Van Canneyt: Aren't they supposed to be coded at least partially in Javascript ? Michael.

Could be. I don't know. I just installed the 4.0 in a VM a day ago and still testing with it. I was asking if somebody has written applet, so I can test it. I plan to install 4.1 in a VM next and will test Lazarus in it too. Lazarus seems to work fine in the 4.0 so far, except that I have to start it from terminal window or from Dolphin .

With best regards,
Boian Mitov

-------------------------------------------------------------------- Mitov Software
http://www.mitov.com
--------------------------------------------------------------------

Earlier message 8 lines
----- Original Message ----- From: "Michael Van Canneyt" To: "General mailing list" Sent: Thursday, July 17, 2008 6:04 AM Subject: Re: [Lazarus] Lazarus KDE4 Plazma applet > Aren't they supposed to be coded at least partially in Javascript ?

Reply by email

Alex Kovacic

-

ENLIGHTENMENT IS MUCH BETTER/FASTER - AND HAS SOME REALLY FAST AND COMPACT LIBRARIES THAT COULD BE USED BY LAZARUS...ELIVE, OPEN GEU, gOS ARE SOME OF THE DISTROS USING IT.

http://enlightenment.org/p.php?p=about/efl&l=en

you wrote 34 lines
Hi Funky, I agree, I am running it in a VM to evaluate it. I was just curious if somebody has written an applet already. I think the 4.0 is rally not ready even for the most basic tasks, but that is IMHO. I will try to install 4.1 to see how it looks. I have heard it is much better. BTW: I am absolutely new on Linux, but I did the transition to KDE 3.5 in no time, and love it. I hope 4 eventually will mature to similar stage. With best regards, Boian Mitov -------------------------------------------------------------------- Mitov Software http://www.mitov.com -------------------------------------------------------------------- ----- Original Message ----- From: "Funky Beast" To: "Lazarus mailing list" Sent: Thursday, July 17, 2008 7:09 AM Subject: Re: [Lazarus] Lazarus KDE4 Plazma applet > Personally, I would wait for at least version 4.3 for daily production > use. > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Alex Kovacic(PTC,HPTC,BSc,MSc)
SENIOR SCIENTICT,
FISH Lab
CYTOGENETICS UNIT,
SEALS,Level 4, Campus Centre,
Prince Of Wales Hospital,
RANDWICK, NSW, 2031,
AUSTRALIA,
Tel: (61) (02) 9382 9168
Fax: (61) (02) 9382 9157
email1:
email2:

Reply by email

Boian Mitov
to Alex Kovacic

Nice, but maybe should have been under a new topic ;-) .

With best regards,
Boian Mitov

-------------------------------------------------------------------- Mitov Software
http://www.mitov.com
--------------------------------------------------------------------

Earlier message 12 lines
----- Original Message ----- From: "Alex Kovacic" To: "General mailing list" Sent: Thursday, July 17, 2008 3:36 PM Subject: Re: [Lazarus] Lazarus KDE4 Plazma applet > ENLIGHTENMENT IS MUCH BETTER/FASTER - AND HAS SOME REALLY FAST AND COMPACT > LIBRARIES THAT COULD BE USED BY LAZARUS...ELIVE, OPEN GEU, gOS ARE SOME OF > THE DISTROS USING IT. > > http://enlightenment.org/p.php?p=about/efl&l=en

Reply by email

Lord Satan
to Alex Kovacic: - ENLIGHTENMENT IS MUCH BETTER/FASTER - AND HAS SOME REALLY FAST AND COMPACT LIBRARIES…
Show quoted text 6 lines
- ENLIGHTENMENT IS MUCH BETTER/FASTER - AND HAS SOME REALLY FAST AND COMPACT LIBRARIES THAT COULD BE USED BY LAZARUS...

Until the e developers come to the conclusion that it's time to rewrite the libs. I don't even know if e17 is beyond alpha stage. Don't get me wrong, enlightenment is really nice and fast, but they have a very unique development style and I don't want to be the one writing bindings for a permanently changing target.

Reply by email

Luiz Americo Pereira Camara
to Mattias Gaertner: On Wed, 16 Jul 2008 21:56:59 -0300 I think, that would be too Delphi incompatible. The…
Mattias Gaertner wrote 28 lines
On Wed, 16 Jul 2008 21:56:59 -0300 Luiz Americo Pereira Camara wrote: > Luiz Americo Pereira Camara wrote: > >> Mattias Gaertner wrote: >> >> >>> It seems, there are no objections. Will you do it? >>> >>> >>> >> Yes. >> >> > I managed to get the discussed behavior with Gtk1, Gtk2, Win32, but > before submitting a patch i'd like to discuss more two issues found: > > - Win32, gtk1, gtk2 does not fires OnChange after Text is changed > through code. Qt does. It's possible to get this behavior in these > widgetsets. What do you think? > I think, that would be too Delphi incompatible.

Ok

Show quoted text 9 lines
> - After an item is deleted the ItemIndex is set to -1 and no event is > fired under win32. Under Gtk1, Gtk2, Qt the next item is selected and > the OnSelect/Change are fired. What path to follow? > The Delphi way. Unless it is too complicated to implement. But we just need to ignore events during a pascal operation, so it is easy, isn't it?

I think is possible.

Luiz

Reply by email

Luiz Americo Pereira Camara
to Mattias Gaertner: On Sat, 12 Jul 2008 15:28:10 -0300 It seems, there are no objections. Will you do it?…
Mattias Gaertner wrote 16 lines
> 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:

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

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

Luiz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ComboBoxItemIndex.zip
Type: application/zip
Size: 2761 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080719/74544ea3/attachment-0003.zip -------------- next part --------------
A non-text attachment was scrubbed...
Name: gtkcomboitemindex_patches.zip
Type: application/zip
Size: 7175 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080719/74544ea3/attachment-0004.zip -------------- next part --------------
A non-text attachment was scrubbed...
Name: ListItemIndex.zip
Type: application/zip
Size: 2501 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080719/74544ea3/attachment-0005.zip

Reply by email

Mattias Gaertner
to Luiz Americo Pereira Camara
Show quoted text 21 lines
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.

Show quoted text 25 lines
- [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.

Show quoted text 6 lines
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

Mattias

Reply by email

Marc Weustink
to Mattias Gaertner
Mattias Gaertner wrote 59 lines
On Sat, 19 Jul 2008 23:05:43 -0300 Luiz Americo Pereira Camara 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.

To stress this for others too...

The widgetset code should never modify any state in the LCL (except for events). This especially counts for CreateHandle code.

Marc

Reply by email

Luiz Americo Pereira Camara
to Mattias Gaertner: On Sat, 19 Jul 2008 23:05:43 -0300 Thanks. Applied. This creates a circle and the LCL…
Mattias Gaertner wrote 15 lines
On Sat, 19 Jul 2008 23:05:43 -0300 Luiz Americo Pereira Camara wrote: > - 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?

It's not showing in my test example. I just double checked now.

I fixed that. Please review. 15831.

Seems OK. I tested with a clean repository under win32. Later i will test the gtk side.

Luiz

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 10 lines
Mattias Gaertner wrote: > I fixed that. Please review. 15831. > > Seems OK. I tested with a clean repository under win32. Later i will test the gtk side.

I found more issues.

The attached patch does the following

- Toggle selection mode in places where it was missing. Avoid items being deselected after clicking twice [gtk1]
- Updates the Index cache after Delete/Clear/Insert. OnSelect was not being called after clicking in the previous selected index [gtk1/2]
- When Combo is read only, set Index to -1 and Text to '' if Text is changed with a value not found in the list [gtk1]
- Move gtk1/combo routines to WS class

Bug 7741 and 8463 can be closed.
7204 needs to test in OSX

The next step is to ensure that only the widgetinfo of the main control is used, so is not needed to allocate the widgetinfo for the child widgets.

Luiz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtkcombo_part2.zip
Type: application/zip
Size: 3553 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080722/07356aec/attachment.zip

Reply by email

Luiz Americo Pereira Camara
to Mattias Gärtner
Mattias G?rtner wrote 10 lines
Zitat von Luiz Americo Pereira Camara : > 7204 needs to test in OSX > > The next step is to ensure that only the widgetinfo of the main control > is used, so is not needed to allocate the widgetinfo for the child widgets. > Will you do that?

Yes. But don't expect a patch before the weekend.

Luiz

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 18 lines
Mattias G?rtner wrote: > Zitat von Luiz Americo Pereira Camara : > > >> 7204 needs to test in OSX >> >> The next step is to ensure that only the widgetinfo of the main control >> is used, so is not needed to allocate the widgetinfo for the child widgets. >> >> > Will you do that? > > Yes. But don't expect a patch before the weekend.

Here it is.

This patch does the following:

- Avoid the creation of WidgetInfo to combox childs [gtk1]
- Pass WidgetInfo as the data to the changed event handler [gtk1]
- Update the ItemIndex cache when inserting items [gtk2]

BTW: the file gtkobject.inc seems unused. Initially i got confused after searching for the places where the info is freed.

Luiz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk_combo_part3.diff.zip
Type: application/zip
Size: 2071 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080727/013c25eb/attachment.zip

Reply by email

Mattias Gaertner
to Luiz Americo Pereira Camara

On Sun, 27 Jul 2008 10:22:03 -0300
Luiz Americo Pereira Camara wrote:

[...]

Show quoted text 8 lines
Here it is. This patch does the following: - Avoid the creation of WidgetInfo to combox childs [gtk1] - Pass WidgetInfo as the data to the changed event handler [gtk1] - Update the ItemIndex cache when inserting items [gtk2]

Thanks. Applied.

BTW: the file gtkobject.inc seems unused. Initially i got confused after searching for the places where the info is freed.

gtkobject.inc?
AFAIR it was removed 9 months ago.

Mattias

Reply by email

Luiz Americo Pereira Camara
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
On Sun, 27 Jul 2008 10:22:03 -0300 Luiz Americo Pereira Camara wrote: > BTW: the file gtkobject.inc seems unused. Initially i got confused > after searching for the places where the info is freed. > gtkobject.inc? AFAIR it was removed 9 months ago.

Somehow it still in my source tree.
Sorry for the false alarm

Luiz

Reply by email