Recent

Author Topic: TListBox SelectAll not working in Linux but works in Windows  (Read 2335 times)

har0ld

  • Newbie
  • Posts: 3
    • CyberCircuits Lab.
TListBox SelectAll not working in Linux but works in Windows
« on: September 06, 2018, 10:24:18 pm »
Good day everyone. It's my first time to post. I have used Pascal in the past but had to switch to .Net and now switching back to Free Pascal for cross-platform development.

As the title says there might be a bug in TListBox component.
 
I have attached a simple example to demonstrate the bug. The same code is working under Windows but not in Linux.

I am using the latest version FPC 3.0.4 and Lazarus 1.8.4
« Last Edit: September 07, 2018, 01:12:03 am by har0ld »

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: TListBox SelectAll not working in Linux but works in Windows
« Reply #1 on: September 06, 2018, 10:42:15 pm »
Tried your example. Works Ok if Multiselect = true (what was initially false in your project).
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

har0ld

  • Newbie
  • Posts: 3
    • CyberCircuits Lab.
Re: TListBox SelectAll not working in Linux but works in Windows
« Reply #2 on: September 06, 2018, 11:32:36 pm »
Thank you very much Sash for pointing that one out, I missed that.

Next if I assign a Context Popup menu to do the Select All sometimes it works and sometimes it does not if I set the Handled=true in the ListBox1ContextPopup event. I wanted to not to show the Context PopupMenu when the list is empty by counting the number of items in the ListBox and setting the Handled to true when the list is empty.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: TListBox SelectAll not working in Linux but works in Windows
« Reply #3 on: September 07, 2018, 12:09:16 am »
What you want is better done using Actions.
Rather than not show a popup menu at all in some circumstance and showing it in another state (considered bad GUI form) it is better to keep the popup menu, and disable the appropriate item.
See attached project

har0ld

  • Newbie
  • Posts: 3
    • CyberCircuits Lab.
Re: TListBox SelectAll not working in Linux but works in Windows
« Reply #4 on: September 07, 2018, 12:49:05 am »
What you want is better done using Actions.
Rather than not show a popup menu at all in some circumstance and showing it in another state (considered bad GUI form) it is better to keep the popup menu, and disable the appropriate item.
See attached project


Thank you very much Howardpc. That partially solved the issue. I found that if there is at least one selection already made, the SelectAll does not work anymore (at least in Linux).
« Last Edit: September 09, 2018, 12:52:38 am by har0ld »

 

TinyPortal © 2005-2018