Recent

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

apeoperaio

  • Sr. Member
  • ****
  • Posts: 272
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: 11830
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.

apeoperaio

  • Sr. Member
  • ****
  • Posts: 272
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: 11830
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.

apeoperaio

  • Sr. Member
  • ****
  • Posts: 272
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: 247
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

  • Sr. Member
  • ****
  • Posts: 272
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: 772
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: 49
  • 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
https://www.COBATA.com/

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • 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

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: 772
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: 772
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: 2770
    • havefunsoft.com
Re: TScrollBox: scrollbars issue
« Reply #12 on: August 29, 2019, 03:54:52 pm »
a sample project?

MISV

  • Hero Member
  • *****
  • Posts: 772
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 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?

 

TinyPortal © 2005-2018