Recent

Author Topic: TListbox behaviour under OpenSuse/Gnome  (Read 4966 times)

Chris_h174

  • New Member
  • *
  • Posts: 13
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #15 on: August 28, 2020, 11:27:44 am »
I can't reproduce with the original example*; you might want to post the  tweaked one to let us see if something changed. In the meantime, test with the attached project and tell me if it also fails, can you?

Note, though, that while the search is in progress and until it can unequivocally select a unique item the OnSelectionChange event won't be fired; might that be what you're seeing? If so, there is nothing you can do: that's how the GTK2 widgetset works.



* Tested on Xubuntu 18.04 x86_64
Thanks for your time Lucamar
I can't get your example to link.  I've been getting "crtbeginS.o" & "crtendS.o" not found for ages but it's never actually prevented linking.
My changes were simply to add ItemIndex to the StatusBar readout and add a listbox line with more common leading characters.
Chris
Chris
Lazarus 2.0.2 fpc3.0.4 on OpenSuse Leap 15.1 and Win7_64.

Chris_h174

  • New Member
  • *
  • Posts: 13
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #16 on: September 01, 2020, 10:14:05 am »
I can't reproduce with the original example*; you might want to post the  tweaked one to let us see if something changed. In the meantime, test with the attached project and tell me if it also fails, can you?

Note, though, that while the search is in progress and until it can unequivocally select a unique item the OnSelectionChange event won't be fired; might that be what you're seeing? If so, there is nothing you can do: that's how the GTK2 widgetset works.



* Tested on Xubuntu 18.04 x86_64
Thanks for your time Lucamar
I can't get your example to link.  I've been getting "crtbeginS.o" & "crtendS.o" not found for ages but it's never actually prevented linking.
My changes were simply to add ItemIndex to the StatusBar readout and add a listbox line with more common leading characters.
Chris
OK.  So I managed to get it to link by selecting "Release" in Project|Options...
It still misbehaves IMHO.  Screenshot below shows "Item th" typed and correct line highlighted but ItemIndex still on "Item two".  If I type an extra character (can be a <space>) it corrects itself.  It looks to me as if ItemIndex lags the highlight by one character.
Thanks
Chris
Chris
Lazarus 2.0.2 fpc3.0.4 on OpenSuse Leap 15.1 and Win7_64.

jamie

  • Hero Member
  • *****
  • Posts: 7665
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #17 on: September 01, 2020, 04:36:36 pm »
I am not a Linux expert but maybe you need to perform a UPDATE during the KeyDown cycle..?

ListBox.Update..

or Repaint...
etc
The only true wisdom is knowing you know nothing

Chris_h174

  • New Member
  • *
  • Posts: 13
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #18 on: September 01, 2020, 04:54:53 pm »
I am not a Linux expert but maybe you need to perform a UPDATE during the KeyDown cycle..?

ListBox.Update..

or Repaint...
etc
I'm very wise but... :) This is the built-in behaviour under gtk2.  I'm not intercepting keydown.
Chris
Chris
Lazarus 2.0.2 fpc3.0.4 on OpenSuse Leap 15.1 and Win7_64.

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #19 on: September 01, 2020, 05:06:24 pm »
It's in fact the default behaviour in GTk. The widgetset uses a relatively small delay to cope with slow typists and in case you made a mistake and have to delete the latest char(s) before admiting (and searching for) the  string. When you type some (more) char it "knows" that the previous ones are probably correct, so it acknowledges all but the more recent.

You can see this in, for example, the file manager (Nautilus, Thunar, pcfman, ...): the corresponding file selection goes always a little behind your typing of the name.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

jamie

  • Hero Member
  • *****
  • Posts: 7665
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #20 on: September 01, 2020, 05:20:31 pm »
Sounds like the gtk was designed for slow old timers ! :)
The only true wisdom is knowing you know nothing

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #21 on: September 01, 2020, 06:12:58 pm »
Sounds like the gtk was designed for slow old timers ! :)

I know you say it tongue-in-cheek but ... not really; in this particular case it does it to avoid having to do a relatively costly operation (the search) repeatedly when it's not really needed.

Think, for example, of a list of image files from a camera: there might be thousands and all of them start with the same four characters, hundreds start with the same five or six, and so on. Delaying the (full) search until the user stops typing makes it much more responsive.

Note also that at any time you can press <enter> to tell the widgetset to update the widget so its not really that cumbersome (most of the times ;))
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Chris_h174

  • New Member
  • *
  • Posts: 13
Re: TListbox behaviour under OpenSuse/Gnome
« Reply #22 on: September 02, 2020, 10:07:05 am »
Sounds like the gtk was designed for slow old timers ! :)

I know you say it tongue-in-cheek but ... not really; in this particular case it does it to avoid having to do a relatively costly operation (the search) repeatedly when it's not really needed.

Think, for example, of a list of image files from a camera: there might be thousands and all of them start with the same four characters, hundreds start with the same five or six, and so on. Delaying the (full) search until the user stops typing makes it much more responsive.

Note also that at any time you can press <enter> to tell the widgetset to update the widget so its not really that cumbersome (most of the times ;))
But I AM a slow old-timer.
I think the reasoning is flawed.  If it needs to behave like that then the highlight should too.  It is indicating to the user that they have selected an item when they have actually selected a different one!  In fact it doesn't always have to do an entire search, it only has to compare with the currently selected one and re-search if it differs.
Chris
Chris
Lazarus 2.0.2 fpc3.0.4 on OpenSuse Leap 15.1 and Win7_64.

 

TinyPortal © 2005-2018