Recent

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

apeoperaio

  • Full Member
  • ***
  • Posts: 159
TScrollBox: scrollbars issue
« on: October 10, 2018, 10:06:25 am »
I have an issue with TScrollBox.
Look at the source below. A Tscrollbox aligned alClient with a Tempo a TListbox and a TButton.

Code: Pascal  [Select]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     ListBox1: TListBox;
  17.     Memo1: TMemo;
  18.     ScrollBox1: TScrollBox;
  19.     procedure FormCreate(Sender: TObject);
  20.   private
  21.  
  22.   public
  23.  
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.  
  29. implementation
  30.  
  31. {$R *.lfm}
  32.  
  33. { TForm1 }
  34.  
  35. procedure TForm1.FormCreate(Sender: TObject);
  36. begin
  37.   memo1.Align:= alTop;
  38.   memo1.Height:= 300;
  39.   ListBox1.Align:= alTop;
  40.   ListBox1.Height:= 300;
  41.   Button1.Align:= alClient;
  42. end;
  43.  
  44. end.
  45.  

When I run my app I can see the vertical scrollbar for few seconds, and I can use I to move on my TScrollBox, but after few seconds the scrollbar disappear and I cannot scroll anymore. In order to make the scrollbar appearing again I must resize the form.



wp

  • Hero Member
  • *****
  • Posts: 6483
Re: TScrollBox: scrollbars issue
« Reply #1 on: October 10, 2018, 10:19:36 am »
If I understand correctly there should not be a scrollbar at all because you client-align the button. Because of the top-aligned memo and listbox and the client-aligned button the scrollbox is completely filled. A scrollbar will appear only when the total extent of the controls within the scrollbox is larger than the clientrect of the scrollbox.

Make the button top-aligned and the scrollbar will be shown if the scrollbox height is less than the combined height of memo, listbox and button.

I don't understand why you see the scrollbar for a few seconds. Please post a complete compilable project.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

apeoperaio

  • Full Member
  • ***
  • Posts: 159
Re: TScrollBox: scrollbars issue
« Reply #2 on: October 10, 2018, 10:32:21 am »
The horizontal scrollbar is not shown, properly, the vertical scrollbar should be shown since I cannot see all my components in the scrollbox. See images.
I attached a sample project. Let me know if I missed something.



wp

  • Hero Member
  • *****
  • Posts: 6483
Re: TScrollBox: scrollbars issue
« Reply #3 on: October 10, 2018, 10:43:23 am »
It's working correctly for me on Windows. But you seem to be on Mac... You should file a bug report then.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

apeoperaio

  • Full Member
  • ***
  • Posts: 159
Re: TScrollBox: scrollbars issue
« Reply #4 on: October 10, 2018, 10:51:15 am »
It's working correctly for me on Windows. But you seem to be on Mac... You should file a bug report then.

It works on windows for me too. I am using Cocoa, so I wrote on Cocoa forum :)

ChrisR

  • Full Member
  • ***
  • Posts: 103
Re: TScrollBox: scrollbars issue
« Reply #5 on: October 11, 2018, 03:17:09 am »
What version of Lazarus are you using? I tested your project with SVN 59284. With this release, the vertical scroll bar looks fine, and it did not disappear on my MacOS 10.13 laptop. I do not that the horizontal scroll bar does seems a bit funny. It works with your stock application - appearing if you make the app very narrow so you need to scroll to see the TButton. However, if you set the Memo1.WordWrap := false and recompile, launch the program and type a long sting so a horizontal scroll bar would be required to pan to see the text. In this case I do not see the horizontal scrollbar.

apeoperaio

  • Full Member
  • ***
  • Posts: 159
Re: TScrollBox: scrollbars issue
« Reply #6 on: October 11, 2018, 10:39:17 am »
I am using Lazarus 2.1.0 r59284 FPC 3.0.4 x86_64-darwin-cocoa (alpha).
The vertical scrollbar works perfectly on panels, buttons, labels etc. but seems that on control including a scrollbar by themselves (or scrollable components, like memo, listbox etc) the TScrollBox scrollbar does not appear.

MISV

  • Hero Member
  • *****
  • Posts: 652
Re: TScrollBox: scrollbars issue
« Reply #7 on: October 21, 2018, 05:52:03 pm »
Just for reference: I experience similar issues with TScrollBox

cobata

  • New Member
  • *
  • Posts: 47
  • Programmer-analyst
    • COBATA Software - Research, Development, Testing, Consulting
Re: TScrollBox: scrollbars issue
« Reply #8 on: March 16, 2019, 10:01:08 am »
Actually, the main forms (the forms at all) MUST have scroll bars and not to use a scroll box instead... I am posted a bug with a promise by Dmitry that TForm will has Scrollbars, but the bug report is going to be 1 year old.

https://bugs.freepascal.org/view.php?id=33988
« Last Edit: October 21, 2019, 12:52:16 pm by cobata »
COBATA Software - Research, Development, Testing, Consulting
http://www.COBATA.com/

VTwin

  • Hero Member
  • *****
  • Posts: 793
  • Former Turbo Pascal 3 user
Re: TScrollBox: scrollbars issue
« Reply #9 on: March 29, 2019, 01:42:46 am »
I've posted Cocoa bug reports that are a few months old now, that have not yet been acknowledged. I realize folks are busy, and greatly appreciate the amazing progress made, I think largely by Dimitry. Maybe he has some other things going on, so no complaints from me. Just hoping these will be addressed.
 
To be clear, I think the current Cocoa widget set has surpassed the Carbon widget set.
« Last Edit: March 29, 2019, 01:54:06 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.13.6: Lazarus 2.0.7 fixes svn 62300 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.6 (64 bit on VBox)
fpc 3.0.4

MISV

  • Hero Member
  • *****
  • Posts: 652
Re: TScrollBox: scrollbars issue
« Reply #10 on: August 29, 2019, 01:34:27 pm »
There is still a scrollbox problem it seems - I am running on a pretty recent trunk (not completely uptodate)

It is like it miscalculates when to show the vertical scrollbar

Imagine I have a window with various controls (toolbar at top, treeview at left, content at riight).
At e.g. right side I have a tscrollbox with a panel inside.

1) If I maximize / size-up the window I can see all controls in my panel.
2) But as I start sizing the window down I need to continue until e.g. 100 pixels hidden in my panel before the parent scrollbar starts to show its scrollbar.
3) If I maximize / size-up the window I can see all controls in my panel.

Has anyone reported such a problem? I will then either chime in on those or try create one

MISV

  • Hero Member
  • *****
  • Posts: 652
Re: TScrollBox: scrollbars issue
« Reply #11 on: August 29, 2019, 02:39:17 pm »
Just tried 61470M - still same problem

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2290
    • havefunsoft.com
Re: TScrollBox: scrollbars issue
« Reply #12 on: August 29, 2019, 03:54:52 pm »
a sample project?
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 652
Re: TScrollBox: scrollbars issue
« Reply #13 on: August 30, 2019, 12:49:27 am »
I will try as soon as possible ... At my real project at the right: I have nested panels/pagecontrol/tabs with a tscrollbox containing a tpanel in one of them.

It is possible it will be necessary to create a more complex demo. (At least if assuming I am the only one experiencing the problem)

If I am the only one experiencing the problem I will also try research this more myself and make some experiments. Maybe I can pinpoint the cause more easily then in the bug report.


trev

  • Sr. Member
  • ****
  • Posts: 254
  • Former Delphi 7 and Delphi 10.2 User
Re: TScrollBox: scrollbars issue
« Reply #14 on: August 30, 2019, 01:11:34 am »
@MISV: I have a Tscrollbox which contains Tlabels and Tcomboboxes and the vertical scrollbar comes and goes as expected depending on the number of controls fitting or not. Maybe your issue is related to Tpanels?
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)