Recent

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

apeoperaio

  • Full Member
  • ***
  • Posts: 152
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: 5636
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: 152
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: 5636
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: 152
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

  • Jr. Member
  • **
  • Posts: 75
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: 152
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: 554
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: 42
  • 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 Dimitry that TForm will has Scrollbars, but the bug report is going to be 1 year old.

https://bugs.freepascal.org/view.php?id=33988
COBATA Software - Research, Development, Testing, Consulting
http://www.COBATA.com/

VTwin

  • Hero Member
  • *****
  • Posts: 655
  • 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.11.6: Lazarus 2.1.0 svn 61174M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)