Scroll ContainerControl: I know old, old Topic

Hi everyone,

i know this Topic comes again and again and i saw also the Xojo-Webinar about ContainerControl, but i didn’t get it work.

I have a couple of ContainerControls and placed them with a PagePanel. The PagePanel hast the Height of the Window. Some ContainerControls are higher. So i wanna scroll them. Did anyone of you has a solution for this “Problem”?

Notice the Scrollbar should be visible only, if the ContainerControl ist higher then the PagePanel!

Best regards

I did this with a 640 point high Container control over a 360 points high PagePanel.

  • Drag the Container control over the page.
  • Make it less than 360 points in height
  • Drag it over the PagePanel until the PagePanel shows with a red border it has become parent of the CC instance.
  • Position the Container control (presumably Top = 0)
  • Make it 640 points high in the inspector. Avoid moving it with the mouse to prevent losing the Parent.
  • Drag a scrollbar over the PagePanel. Make its maximum 640-360, default value zero.
  • Make the ScrollBar LiveScroll On in the Inspector.
  • In the ScrollBar,

If Me.cell(Row, Column) <> "" then g.ForeColor = &c00FFFF00 g.FillRoundRect(0,0,g.width*0.9,g.Height*0.9,g.Height/2, g.Height/2) g.ForeColor = &c00000000 end if

[quote=221903:@Michel Bujardet]

If Me.cell(Row, Column) <> "" then g.ForeColor = &c00FFFF00 g.FillRoundRect(0,0,g.width*0.9,g.Height*0.9,g.Height/2, g.Height/2) g.ForeColor = &c00000000 end if[/quote]
Thanks Michel for your request. Your Code is ListBox-Code?!

Sorry :

Sub ValueChanged() ContainerControl11.Top = -(me.value) End Sub

Got it! Yes, yes, yes! :smiley:
[h]Properties:[/h]

YScrollLast As Integer

[h]Window1.Open:[/h]

Sub Open() ScrollBar1.Maximum = ContainerControl1.Height - PagePanel1.Height End Sub
[h]Window1.Resizing:[/h]

Sub Resizing() setContainer End Sub
[h]Window1.setContainer:[/h]

Private Sub setContainer() If PagePanel1.Height >= ContainerControl1.Height Then ScrollBar1.Value = 0 ScrollBar1.Visible = False Canvas1.Width = PagePanel1.Width Else ScrollBar1.Maximum = ContainerControl1.Height - PagePanel1.Height ScrollBar1.Visible = True Canvas1.Width = PagePanel1.Width - ScroolBar1.Width End If End Sub
[h]Window1 Control ScrollBar1:[/h]

Sub ValueChanged() Dim Delta As Integer Delta = YScrollLast - Me.Value Canvas1.Scroll(0, Delta, 0, 0, ContainerControl1.Width, ContainerControl1.Height, True) YScrollLast = Me.Value End Sub
[h]Window1 Control Canvas1:[/h]

Function MouseWheel(X As Integer, Y As Integer, deltaX as Integer, deltaY as Integer) As Boolean If PagePanel1.Height < ContainerControl1.Height Then ScrollBar1.Value = ScrollBar1.Value + deltaY End If End Function