Recent

Author Topic: TPageControl issue under Linux  (Read 1712 times)

simone

  • Hero Member
  • *****
  • Posts: 689
TPageControl issue under Linux
« on: March 19, 2021, 03:21:38 pm »
I noticed some unwanted differences in the behavior of the TPageControl component between Windows and Linux:

- under Linux, if the mouse click occurs over the tab label, the OnMouseUp event is not triggered when the raised button is the right one.

- under Linux, a popup menu is automatically created that allows you to switch between tabs when you right-click on the tab label.

I guess the two differences detected are related to each other and due to the two different underlying widgset. I would like to be able to solve the first problem, as I need to detect that type of event. Do you have any solution?
« Last Edit: March 19, 2021, 03:26:40 pm by simone »
Microsoft Windows 10/11 64 bit - Lazarus 3.8/4.0 FPC 3.2.2 x86_64-win64-win32/win64

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: TPageControl issue under Linux
« Reply #1 on: March 19, 2021, 03:56:02 pm »
In the TPageControl Options property, set nboHidePageListPopup to True (in the OI) or add it (in code). That should solve both issues (which are, indeed, related).

(Tested on Linux x86_64 with Lazarus/FPC 2.0.12/3.2.0 GTK)
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.

simone

  • Hero Member
  • *****
  • Posts: 689
Re: TPageControl issue under Linux
« Reply #2 on: March 19, 2021, 04:24:53 pm »
Thanks Lucamar. Your solution works as long as you have not associated a popup menu to the tpagecontrol component. In this case the event is not triggered under Linux, while in Window it is. I have attached an example to reproduce the problem.
« Last Edit: March 19, 2021, 04:39:43 pm by simone »
Microsoft Windows 10/11 64 bit - Lazarus 3.8/4.0 FPC 3.2.2 x86_64-win64-win32/win64

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: TPageControl issue under Linux
« Reply #3 on: March 19, 2021, 08:10:33 pm »
Yeah, you're right. It seems that as soon as there is any associated popup, whether system- or application-generated, the "mouse up" is consumed by the popup menu itself which, while logical enough, might be a trifle annoying.

A workaround might be to add a call to your OnMouseUp handler in the menu items's OnClick handler, for which you might, for example save the mouse state (coordinates, buttons and shift state) in the menu's OnPopUp handler. Not really a piece of cake but doable.

What I'm not sure is whether this behaviour could be considered a bug or simply widegetset-dependant, as so many other things, but if you want to can add a report to the bug tracker, even if just to see what the devs think :-\
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.

simone

  • Hero Member
  • *****
  • Posts: 689
Re: TPageControl issue under Linux
« Reply #4 on: March 19, 2021, 08:39:33 pm »
Thanks again. In my particular case I got what I wanted by moving the operations from the OnMouseUp handler of the TPageControl component to the OnClose handler of the popup menu.

Microsoft Windows 10/11 64 bit - Lazarus 3.8/4.0 FPC 3.2.2 x86_64-win64-win32/win64

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: TPageControl issue under Linux
« Reply #5 on: March 19, 2021, 08:56:14 pm »
Yeah, that would work too. In fact, it's a better option since it handles also the case where the user selects no item but just dismisses the menu.

Wonder why I didn't think about it :-[
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.

simone

  • Hero Member
  • *****
  • Posts: 689
Re: TPageControl issue under Linux
« Reply #6 on: March 22, 2021, 04:27:24 pm »
I found another difference in TPageControl behavior between Windows (Widgetset Win32) and Linux (GTK2). In Linux, unlike Windows, the popup menu is activated if you click with the right mouse button inside the area identified by the red rectangle in the figure.
« Last Edit: March 22, 2021, 04:29:20 pm by simone »
Microsoft Windows 10/11 64 bit - Lazarus 3.8/4.0 FPC 3.2.2 x86_64-win64-win32/win64

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: TPageControl issue under Linux
« Reply #7 on: March 22, 2021, 04:56:12 pm »
You'll find quite a lot of "small" differences like that: after all, they are different widgetsets.

For example, nboShowCloseButton (in Options) works as expected in GTK2 while in Windows it doesn't; etcetera ...

The important thing to remember is that users of those system expect those particular behaviours in their different systems, so there is nothing wrong with that. Except maybe with things like the "close/add tab" buttons, which have become the norm for any system.
« Last Edit: March 22, 2021, 05:00:02 pm by lucamar »
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.

 

TinyPortal © 2005-2018