Jump to content


Photo

Scrollbar style


  • Please log in to reply
43 replies to this topic

#21 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 13 July 2008 - 11:08 PM

Could you also solve the problems with hidden rows and rows with different height?

My solution doesn't sync the vertical scrollbar correctly in combination with these functionalities, but I think it shouldn't be too hard to implement that...

#22 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 14 July 2008 - 11:48 AM

Hello Aim,

I will do this. I think that I will need one for loop for this situation.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#23 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 15 July 2008 - 10:52 AM

Hi Boki,

Nice to see the scrollbar now reflects the size of the thing being scrolled. But did you think of a minumum size too? To prevent sliders being to small to drag with a mouse?
G.W. van der Vegt

#24 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 15 July 2008 - 12:32 PM

Hello Wim,

I think that there is already minimum size and that page size can't be smaller than some amount of pixels.

I still need to get figure out how all work and I hope that I will smile.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#25 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 26 July 2008 - 10:45 PM

Hello,

I have re-upload pre-release files on Members Section with included AIM's fix.

I hope that it work fine.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#26 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 27 July 2008 - 12:39 PM

QUOTE
I have re-upload pre-release files on Members Section with included AIM's fix.


Boki, thanks for applying my code smile.gif

One issue I have found so far with the horizontal scrollbar:

You have removed the line "HorzScrollBar.Position := GetRealScrollPosition(HorzScrollBar);" in "TNxCustomGridControl.UpdateHorzScrollBar;"

But this line is important when you try the following:

1. Fill a grid where no horizontal scrollbar is displayed
2. Enlarge a column until the horizontal scrollbar is displayed
3. Scroll the horizontal scrollbar a bit to right
4. Decrease the column with until the horizontal scrollbar is removed

You will see that the grid doesn't move back to the most left column. With "HorzScrollBar.Position :=" this will be ensured.
If you are not able to follow my description, I'll make a small video...

I'll do more testing next week, but everything else looked OK in a first test... smile.gif

#27 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 27 July 2008 - 01:37 PM

Hello Aim,

Thank you too,

I have add this line, but not sure do I need to add it to the Vertical scroll bar.

I have also one problem when you press bottom arrow on vertscrollbar, it keeps scrolling. Do you have idea what we may do. This happen in Demo 1 project.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#28 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 27 July 2008 - 02:23 PM

QUOTE
I have add this line, but not sure do I need to add it to the Vertical scroll bar.


I think you need it only for the horizontal scrollbar...

QUOTE
I have also one problem when you press bottom arrow on vertscrollbar, it keeps scrolling. Do you have idea what we may do. This happen in Demo 1 project.


I haven't found a way to reproduce it here. What must I exactly click to get this behavior?
Only clicking the bottom arrow stops scrolling when the end of rows is arrived...

#29 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 27 July 2008 - 02:29 PM

Hello Aim,

I thinks that it only happen under some cases. Now I have repeat test and nothing.

I really hope that I am near stable version smile.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#30 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 28 July 2008 - 10:38 AM

Boki,

I have found another issue which does not appear in my original version. Download the attached demo, click the "Button5" button and try to scroll down to the last row. You'll see that it jumps back to the top.

To fix this, replace the code in "TNxCustomGridControl.UpdateVertScrollBar" from

CODE
  if (VertScrollBar.Max <= VertScrollBar.PageSize) and (VertScrollbar.Position <> 0) then
    VertScrollbar.Position := 0;


back to

CODE
  if (VertScrollBar.Max < VertScrollBar.PageSize) and (VertScrollbar.Position <> 0) then
    VertScrollbar.Position := 0;


You had changed the < to <= what causes this effect...

Attached Files



#31 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 28 July 2008 - 03:01 PM

Hello Aim,

I have change it back. Not sure why this was needed smile.gif

regards and thanks
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#32 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 28 July 2008 - 08:18 PM

Boki, I ran into another problem with the vertical Scrollbar.

Adding back the VertScrollbar.Position line fixes these problems.

My code is now:

CODE
procedure TNxCustomGridControl.UpdateVertScrollBar;

...........

begin
  ScrollMax := GetVisibleRows;
  if GridStyle = gsReport then PageSize := GetRowsTotalHeight
    else PageSize := GetSlidesTotalHeight;
  if ScrollMax > PageSize then
  begin
    VertScrollBar.Max := ScrollMax;
    VertScrollBar.PageSize := PageSize + 1;
    VertScrollbar.Position := FFirstRow; // ----------------------- added
    VertScrollBar.LargeChange := VertScrollBar.PageSize;
  end else
  begin
    VertScrollBar.Max := 0;
  end;

  // Set position to zero if no scrollbar is displayed (for example after resizing the window)

  if ((VertScrollBar.Max < VertScrollBar.PageSize) and (VertScrollbar.Position <> 0)) then
    VertScrollbar.Position := 0;
end;


I had the VertScrollbar.Position assignment for months in my tweaked version and it worked without problems... So I think you can add it without side effects...

#33 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 28 July 2008 - 08:51 PM

Shit, the .Position doesn't work properly with invisible rows or when collapsed tree columns are available sad.gif
Will try to find a reproducible demo tomorrow...

#34 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 28 July 2008 - 09:09 PM

I could find a demo now, see the attached image. It's easier to show a video in that case wink.gif

The last scroll up is made with the cursor up key.

This video was made without .Position:=
It would work with .Position, but .Position is not compatible with invisible or collapsed rows sad.gif
Probably you have an idea how to bypass that problem. I'll run more tests tomorrow...

Attached Files



#35 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 28 July 2008 - 09:25 PM

Hello Aim,

I will see what I can do sad.gif

This scrollbar was real pain.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#36 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 28 July 2008 - 11:36 PM

I have spent some time now and I hope that I found a working solution. I will run more tests tomorrow. Let's hope that everything goes well!!!

Here's my latest version:

CODE
procedure TNxCustomGridControl.UpdateVertScrollBar;

...........

  function GetFirstVisibleRowNumber:integer;
  var
   i:integer;
  begin
    result := 0;
    for i:=0 to FFirstRow-1 do
    begin
      if GetRowVisible(i) then
         inc(result);
    end;
  end;

begin
  ScrollMax := GetVisibleRows;
  if GridStyle = gsReport then PageSize := GetRowsTotalHeight
    else PageSize := GetSlidesTotalHeight;
  if ScrollMax > PageSize then
  begin
    VertScrollBar.Max := ScrollMax;
    VertScrollBar.PageSize := PageSize + 1;
    VertScrollBar.LargeChange := VertScrollBar.PageSize;
  end else
  begin
    VertScrollBar.Max := 0;
  end;

  // Set position to zero if no scrollbar is displayed (for example after resizing the window)
  if ScrollMax <= PageSize + 1 then
     VertScrollbar.Position := GetFirstVisibleRowNumber;
  //if (VertScrollBar.Max < VertScrollBar.PageSize) and (VertScrollbar.Position <> 0) then
  //   VertScrollbar.Position := 0;
end;


#37 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 29 July 2008 - 12:14 AM

Hello Aim,

Thank you again very much! I will test it too.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#38 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 30 July 2008 - 12:16 AM

Hello Aim,

I have include it in my code. I hope that it will work well. I only hope that code is not to much complicated to maintain in future.

Thank you again,

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#39 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 30 July 2008 - 11:43 AM

QUOTE
I have include it in my code. I hope that it will work well.


I haven't found any issues here in my tests, everything seems to work well now. smile.gif

#40 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 30 July 2008 - 03:41 PM

Hello Aim,

Thank you again, I ove you a favor. smile.gif

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users