Recent

Author Topic: Flickering with TScrollbox  (Read 2723 times)

simsee

  • Full Member
  • ***
  • Posts: 230
Flickering with TScrollbox
« on: October 10, 2023, 11:57:16 pm »
I have a similar problem to the one described in the following video:

https://www.youtube.com/watch?v=jo7FUPy5SEU

In my case I have a form containing a scrollbox. The form caption shows the current coordinates of the mouse pointer. If the scrollbars are visible, the edge of the scrollnox flickers. If I set the BorderStyle to bsNone, the problem does not occur. Can anything be done to avoid this problem? Thank you.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Flickering with TScrollbox
« Reply #1 on: October 11, 2023, 12:01:44 am »
Can anything be done to avoid this problem?
Yes.
Thank you.
You are welcome.


Ps. for better help you should provide a test project that shows your problem.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

simsee

  • Full Member
  • ***
  • Posts: 230
Re: Flickering with TScrollbox
« Reply #2 on: October 11, 2023, 12:07:56 am »
Thanks for the support. The problem arises under Windows o.s. (Lazarus 2.2.6 - FPC 3.2.2 x86_64-win64-win32/win64) . See attached project to reproduce.
« Last Edit: October 11, 2023, 12:09:53 am by simsee »

dsiders

  • Hero Member
  • *****
  • Posts: 1497
Re: Flickering with TScrollbox
« Reply #3 on: October 11, 2023, 12:34:31 am »
Thanks for the support. The problem arises under Windows o.s. (Lazarus 2.2.6 - FPC 3.2.2 x86_64-win64-win32/win64) . See attached project to reproduce.

The flicker is the border for the control being redrawn. Set the BorderStyle for the TScrollBox to bsNone and the problem is gone.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

simsee

  • Full Member
  • ***
  • Posts: 230
Re: Flickering with TScrollbox
« Reply #4 on: October 11, 2023, 12:41:53 am »
As I wrote in my initial post, I already know this solution. I would like to know if there are alternatives to eliminating the border.

jamie

  • Hero Member
  • *****
  • Posts: 7420
Re: Flickering with TScrollbox
« Reply #5 on: October 11, 2023, 12:44:58 am »
Turn off the border as stated and drop the scrollbox inside a Tpanel, the Panel has border control that is actually better and it does not flicker like that.

 Just do a CUT of your current scrollbox and Paste inside the Panel, Set the Align=Client for the scrollbox. etc.
The only true wisdom is knowing you know nothing

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Flickering with TScrollbox
« Reply #6 on: October 11, 2023, 12:48:08 am »
In attachment is a possible fix/solution.

Flickering with my way = zero.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

jamie

  • Hero Member
  • *****
  • Posts: 7420
Re: Flickering with TScrollbox
« Reply #7 on: October 11, 2023, 01:01:41 am »
I never use a scrollbox alone anyways. THe border is never on.
The only true wisdom is knowing you know nothing

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Flickering with TScrollbox
« Reply #8 on: October 11, 2023, 05:54:25 pm »
Since topic is not marked as solved, I like to ask what is still wrong / not working?

I would like to know if there are alternatives to eliminating the border.
I showed you an alternate way how everything can stay like it is and you still can manipulate the Caption in whatever way.
Eliminating the Border/Redraw would cause more troubles, it is better to let OS mechanic do its things normally.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

simsee

  • Full Member
  • ***
  • Posts: 230
Re: Flickering with TScrollbox
« Reply #9 on: October 11, 2023, 06:36:27 pm »
Sorry for the delay, I've been busy at work. Both proposed solutions solve the problem, which I believe does not occur with other widgetsets under Linux (Qt, GTK). I haven't tried it, but I report what I read in the comments of the YouTube video I linked. Thanks for the support.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11926
  • Debugger - SynEdit - and more
    • wiki
Re: Flickering with TScrollbox
« Reply #10 on: October 11, 2023, 06:47:14 pm »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11926
  • Debugger - SynEdit - and more
    • wiki
Re: Flickering with TScrollbox
« Reply #11 on: October 11, 2023, 06:56:50 pm »
It may be the scrollbars AutoScroll property.

Disabling that (and just setting the scrollbars) => seems fine

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11926
  • Debugger - SynEdit - and more
    • wiki

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11926
  • Debugger - SynEdit - and more
    • wiki
Re: Flickering with TScrollbox
« Reply #13 on: October 11, 2023, 08:11:34 pm »
There is still an issue though.

Timer with interval=10
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Timer1Timer(Sender: TObject);
  2. begin
  3.   Invalidate;
  4. end;

And it still flickers.

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40548
« Last Edit: October 11, 2023, 08:15:31 pm by Martin_fr »

simsee

  • Full Member
  • ***
  • Posts: 230
Re: Flickering with TScrollbox
« Reply #14 on: February 10, 2024, 05:24:33 pm »
It seems to me that with the version of Lazarus 3.0 - FPC 3.2.2 x86_64-win64-win32/win64, the fickering problem I reported has been resolved. I am grateful to those who can confirm this on other platforms as well.

Thanks to the development team.

 

TinyPortal © 2005-2018