Jump to content


Photo

ScrollBars visible?


  • Please log in to reply
5 replies to this topic

#1 m610

m610
  • Members
  • 33 posts

Posted 22 June 2009 - 07:15 AM

How can I tell if the scroll bars are visible on my NextGrid? I'd like to be able to automatically adjust column widths so that once the vertical scroll bar is visible so that the useless (in my case) horizontal scroll bar does not appear? I've done this before myself, calculating how many cells my grid can display without a scroll bar, then adjusting column widths accordingly.

While I am asking, how can I find out how wide the scroll bars are? In the past I figured this out by trial and error and defined a constant to hold that value. That might be OK in some cases but in Vista or other OS's the scroll bar widths may be different.

Thanks.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 June 2009 - 04:22 PM

Hello m610,

You may read VertScrollBar or HorzScrollBar public properties. You may write something like:

CODE
if  NextGrid1.HorzScrollBar.Visible then ...


I hope that this helps.

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.

#3 Jordan

Jordan
  • Members
  • 14 posts

Posted 14 July 2009 - 01:18 AM

This function call returns the width of windows' scrollbars:

sbwidth := GetSystemMetrics(SM_CXVSCROLL);

It seems to work for me.

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 14 July 2009 - 08:21 AM

Hello Jordan,

Yes, this function should 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.

#5 Jordan

Jordan
  • Members
  • 14 posts

Posted 18 July 2009 - 12:25 AM

The NextGrid.InnerWidth property will give you the number of pixels available. When I tried it, it seemed to take into account both the vertical scroll bar and the indicator column.

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 18 July 2009 - 10:58 AM

Hello Jordan,

Yes, you are correct. It only exclude grid borders.

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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users