Recent

Author Topic: TScrollBox: scrollbars issue  (Read 9385 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: TScrollBox: scrollbars issue
« Reply #15 on: August 31, 2019, 09:01:33 pm »
Are you sure this is not just Mac functionality?

In Firefox, Messages, the Finder, or iTunes, for example, the scrollbar "thumbs" are not visible unless actively scrolling.

You can not see or grab the thumb until you scroll. If you stop, they disappear. I hate it, but it seems to be expected behavior.
« Last Edit: August 31, 2019, 09:07:18 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: TScrollBox: scrollbars issue
« Reply #16 on: August 31, 2019, 09:21:38 pm »
You can not see or grab the thumb until you scroll. If you stop, they disappear. I hate it, but it seems to be expected behavior.
The term "hate" suggests that you need to know - this behavior is configurable.

"System Preferences" -> "General" -> "Show Scroll Bars" -> "Always"

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: TScrollBox: scrollbars issue
« Reply #17 on: August 31, 2019, 10:00:54 pm »
:D Thanks.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: TScrollBox: scrollbars issue
« Reply #18 on: September 09, 2019, 10:28:14 pm »
Are you sure this is not just Mac functionality?

In Firefox, Messages, the Finder, or iTunes, for example, the scrollbar "thumbs" are not visible unless actively scrolling.

You can not see or grab the thumb until you scroll. If you stop, they disappear. I hate it, but it seems to be expected behavior.

Yes, because it is impossible for me to scroll the content into view. The scrollbar shows, I just can't scroll it far enough. I am sorry for my slow feedback on this. But it is not forgotten. I have some bug reports open and I intend to return to them with examples as soon as possible, so you can reproduce. I understand that is a required #1 step :)

cobata

  • New Member
  • *
  • Posts: 49
  • Programmer-analyst
    • COBATA Software - Research, Development, Testing, Consulting
Re: TScrollBox: scrollbars issue
« Reply #19 on: October 18, 2019, 12:34:58 pm »
I just would like to note that Dmitry is already fixed the problem I reported in Mantis and I pointed here (time ago):
https://bugs.freepascal.org/view.php?id=33988
« Last Edit: October 21, 2019, 12:42:10 pm by cobata »
COBATA Software - Research, Development, Testing, Consulting
https://www.COBATA.com/

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: TScrollBox: scrollbars issue
« Reply #20 on: October 18, 2019, 01:54:33 pm »
I am playing with it today.

I have this construct many places

TPageControl (this may be nested under other controls, align alClient) > TTabSheet

In this I have
- TScrollBox(align alClient)

In scrollbox I then have
- TPanel (align AlTop)

That is the most simple construct. I am wondering if my problems (if you do not experience them) are related to TPageControl/TTabSheet and many nested controls. Still hard to understand how the scrollbox miscalculates its own area

... A really corny "fix" seems to be iterate all controls and then:

Code: Pascal  [Select][+][-]
  1.    
  2.    if
  3.       (AControl is TPanel)
  4.     and
  5.       ( (AControl.Top = 0) and (AControl.Align = alTop) )
  6.     and
  7.       (AControl.Parent is TScrollBox)
  8.     and
  9.       ( (AControl.Parent.Parent is TTabSheet) or (AControl.Parent.Parent is TPanel) )
  10.     then
  11.       begin
  12.         AControl.Height := AControl.Height + 65;
  13.       end
  14.     ;
  15.  

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: TScrollBox: scrollbars issue
« Reply #21 on: February 18, 2020, 12:22:07 am »
I am playing with this again since the "solution" I posted is not a 100% solution and not very satisfying at that either.

I have one bit of news. I tried to load the project into Windows/Lazarus. Scrollbars seem to behave as expected there.

I will return to work inside Lazarus/Mac/Cocoa, but I just wanted to test on Windows/Lazasus/LCL to see if maybe my problem was not really Cocoa related.

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: TScrollBox: scrollbars issue
« Reply #22 on: February 19, 2020, 03:15:49 am »
--- I am looking at at workarounds until someday I figure out why ---

What is the best way to force a tscrollbox to recalculate if it should show scrollbars?

Info:
If I resize the form just a few pixels it is enough to trigger recalculation so it shows the scrollbars correctly
(like it should also have done all the time since a lot of the TPanel in TScrollBox is hidden)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: TScrollBox: scrollbars issue
« Reply #23 on: February 19, 2020, 06:22:54 am »
Can you provide a minimal project which demos the problem?

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: TScrollBox: scrollbars issue
« Reply #24 on: February 19, 2020, 09:54:01 am »
I will attempt, but the problem I am experiencing on is on a project with massive amount of nested controls.

So meanwhile, if I can find a combination of workarounds even if not ideal, it is *much* better than no solution. 

(And such workarounds may also help others. It is my impression LCL-Cocoa is improving every day due to the massive work by skalogryz and possibly others as well, so the problems I am experiencing now may be gone in a couple of years. Crossing fingers)


MISV

  • Hero Member
  • *****
  • Posts: 783
Re: TScrollBox: scrollbars issue
« Reply #25 on: February 21, 2020, 05:55:41 pm »
I am playing with it today.

I have this construct many places

TPageControl (this may be nested under other controls, align alClient) > TTabSheet

In this I have
- TScrollBox(align alClient)

In scrollbox I then have
- TPanel (align AlTop)

That is the most simple construct. I am wondering if my problems (if you do not experience them) are related to TPageControl/TTabSheet and many nested controls. Still hard to understand how the scrollbox miscalculates its own area

... A really corny "fix" seems to be iterate all controls and then:

Code: Pascal  [Select][+][-]
  1.    
  2.    if
  3.       (AControl is TPanel)
  4.     and
  5.       ( (AControl.Top = 0) and (AControl.Align = alTop) )
  6.     and
  7.       (AControl.Parent is TScrollBox)
  8.     and
  9.       ( (AControl.Parent.Parent is TTabSheet) or (AControl.Parent.Parent is TPanel) )
  10.     then
  11.       begin
  12.         AControl.Height := AControl.Height + 65;
  13.       end
  14.     ;
  15.  

One more workaround:
When changing tab, resize the panel contained in a scrollbox plus one pixel in height and then minus one pixel in height


This seems to help solve the problem as well


 

TinyPortal © 2005-2018