Scrollview question

Post

Posted
Rating:
#1 (In Topic #786)
Regular
bill-lancaster is in the usergroup ‘Regular’
 I've only just noticed this.

If I place a control (a button say) in a scrollview container with it's .X value greater than scrollview.W then the horizontal scrollbar is initiated and the control can be brought into view.

However if the .X position of the control is less than scrollview.X then the scrollbar is not initiated.

In other words, a child object to the right of the scrollview can be viewed whereas a child object to the right cannot.

Is this to be expected?
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’

bill-lancaster said

I've only just noticed this.

If I place a control (a button say) in a scrollview container with it's .X value greater than scrollview.W then the horizontal scrollbar is initiated and the control can be brought into view.

However if the .X position of the control is less than scrollview.X then the scrollbar is not initiated.

In other words, a child object to the right of the scrollview can be viewed whereas a child object to the right cannot.

Is this to be expected?

Probably the scrollview.Arrange setting
Arrange.None will give freedom to place objects where you expect them to be and make scrollbars work as expected i should think.

and i don't get this …
In other words, a child object to the right of the scrollview can be viewed whereas a child object to the right cannot.
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
bill-lancaster is in the usergroup ‘Regular’
Thanks Bruce
I thought I'd make it clearer with the last statement, unfortunately it should read:-
In other words, a child object to the right of the scrollview can be viewed whereas a child object to the LEFT cannot.
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
bill-lancaster is in the usergroup ‘Regular’
Tried changing the arrange settings - makes no difference.

Perhaps you might try this:-

Code

Public Sub Form_Open()
Dim hScrollview As New ScrollView(Me)
  With hScrollview
    .X = 10
    .Y = 10
    .W = 500
    .H = 500
  End With
Dim hFrame As New Frame(hScrollview)
  With hFrame
    .X = -100
    .Y = -10
    .W = 200
    .H = 200
  End With
Dim hFrame2 As New Frame(hScrollview)
  With hFrame2
    .X = 450
    .Y = 50
    .W = 200
    .H = 200
  End With
End

Thanks
Bill
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
Aah i see.

You cannot use negative numbers.
the box has been placed -100 to the scrollview.X 0 position so it's right.

you should place the frame at 0 and scroll the view +100 to get the same effect.

like this is how i'd do it ..

Code (gambas)

  1. Public Sub Form_Open()
  2.  
  3.   Dim hScrollview As New ScrollView(Me)
  4.   With hScrollview
  5.     .Name = "SView"
  6.     .ScrollBar = Scroll.Both
  7.     .Expand = True
  8.     .X = 10
  9.     .Y = 10
  10.     .W = 500
  11.     .H = 500
  12.   Dim hFrame As New Frame(hScrollview)
  13.   With hFrame
  14.     .X = 0
  15.     .Y = 0
  16.     .W = 200
  17.     .H = 200
  18.   Dim hFrame2 As New Frame(hScrollview)
  19.   With hFrame2
  20.     .X = 450
  21.     .Y = 50
  22.     .W = 200
  23.     .H = 200
  24.  
  25.  
  26. Public Sub Form_Show()
  27.  
  28.   Dim hScrollview As ScrollView = Me["SView"]
  29.   hScrollview.ScrollX = 100
  30.   hScrollview.ScrollY = 20
  31.  
  32.  
Online now: No Back to the top

Post

Posted
Rating:
#6
Regular
bill-lancaster is in the usergroup ‘Regular’
 Thanks Bruce, so negative positions for child objects is not allowed, that explains it.
Thanks again,
Bill
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
 Yeah, the scrollviews left edge 0 is as it is, the left edge. Then the view is scrolled and it's position is negative to the visible window but still 0 to the scrollview object, anything placed negative of that will remain there.
Online now: No Back to the top
1 guest and 0 members have just viewed this.