Recent

Author Topic: Toolbar button not returning from pressed state.  (Read 2943 times)

kapibara

  • Hero Member
  • *****
  • Posts: 610
Toolbar button not returning from pressed state.
« on: January 27, 2022, 11:49:54 am »
Toolbar buttons appear as not returned to "unpressed" state after clicking them to show a messagedialog and dialog has gone away.  When mouse pointer is moved inside main form, the toolbutton reacts and appears without the "pressed" frame around it.

Is there a workaround for this? Is it a bug?

Small demo of the problem attached.
« Last Edit: January 27, 2022, 12:11:12 pm by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Toolbar button not returning from pressed state.
« Reply #1 on: January 27, 2022, 11:52:39 am »
I'm assuming Linux, but which widget set and window manager?

Zvoni

  • Hero Member
  • *****
  • Posts: 2300
Re: Toolbar button not returning from pressed state.
« Reply #2 on: January 27, 2022, 12:01:10 pm »
at a guess: you're in the Click-Event calling a modal MessageDlg, which stops execution of code as long the Dialog is not answered.
Have you tried using the MouseUp-Event instead of Click?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: Toolbar button not returning from pressed state.
« Reply #3 on: January 27, 2022, 12:05:54 pm »
Widgetset is GTK2. Window manager is KWin. (KDE Plasma default)

Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: Toolbar button not returning from pressed state.
« Reply #4 on: January 27, 2022, 12:10:02 pm »
@Zvoni: this remains after the message dialog has gone away.

I tried putting the code for the dialog in the MouseUp event, but same thing happens.

Moving the mouse a little returns the button to normal.
« Last Edit: January 27, 2022, 12:12:37 pm by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

Zvoni

  • Hero Member
  • *****
  • Posts: 2300
Re: Toolbar button not returning from pressed state.
« Reply #5 on: January 27, 2022, 01:22:07 pm »
So, something in the MouseOver-Event of the Widget-Source itself changes the "Bitmap" of the Button/changes the "status" of the button (from "pressed" to "unpressed")

Maybe a Refresh (Validate or something)?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: Toolbar button not returning from pressed state.
« Reply #6 on: January 27, 2022, 03:21:10 pm »
Tried that plus many other things, but the button stays "down" anyway, until mouse is moved. Went through the sources of TForm, its anscestors, TToolBar and TToolButton but didn't become any wiser.  :)
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

zeljko

  • Hero Member
  • *****
  • Posts: 1591
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Toolbar button not returning from pressed state.
« Reply #7 on: January 28, 2022, 11:12:21 am »
That can be caused by theme drawer in LCL

 

TinyPortal © 2005-2018