[Gambas-user] Is there a way to test if a gridview scrollbar is actually visible at runtime?

T Lee Davidson t.lee.davidson at gmail.com
Fri May 8 17:52:05 CEST 2020


On 5/8/20 4:27 AM, Bruce wrote:
> I'm trying to co-ordinate a set of 4 gridview/tableviews.  Depending on the number of columns and rows in each I need to adjust 
> the heights of others and also perform similar scrolling on the others when one is scrolled.
> I can see which scrollbars are "allowed" in each but I can't find a way to check which ones are actually visible at any 
> particylar point in time.
> 
> please help.
> b
> 
> (as usual long explanation...
> it's a four way grid, i.e. 2x2 and so if the user scrolls [0,0] to the right then all the others need to scroll similarly. 
> Simple? Fine? No. The grids are inside hsplits and vsplits so the presence of any scrollbar is entirely dependant on the way the 
> user has currently oriented the entire heirarchy of splits and grids.

For coordinated scrolling, I take it you've already thought of something like this:

Public Sub GridView1_Scroll()

   GridView2.ScrollX = GridView1.ScrollX
   GridView2.ScrollY = GridView1.ScrollY
   GridView3.ScrollX = GridView1.ScrollX
   GridView3.ScrollY = GridView1.ScrollY
   GridView4.ScrollX = GridView1.ScrollX
   GridView4.ScrollY = GridView1.ScrollY

End

To determine if a scroll bar is visible, this seems to work:
bGv1HorBarVisible = GridView1.ScrollWidth > GridView1.Width
bGv1VertBarVisible = GridView1.ScrollHeight > GridView1.Height

(And, also as usual, I probable misunderstood what you're trying to accomplish.)


-- 
Lee


More information about the User mailing list