A good scroll bar tutorial.

Does anybody recommend a good tutorial for learning the scroll bar? Thanks!

Have you tried here:
Language Reference Link

Thanks @Richard Summers . I’ve seen this already, but I was looking for a more hands on tutorial. I looked at the Xojo programming book, but it didn’t really cover the scroll bar (although it covered many other “pickers”).

Scrollbar is a pretty simple control. What is it you want to achieve ?

I have a scrollbar placed in a container control and when I run the program, it doesn’t function at all. I saw an earlier post where it was suggested to make the line step 20. The PageStep changed to 20 automatically. I made the initial state maximum 1000 for testing. Since I’m not familiar with the scrollbar coding, I haven’t added any events, but I’m guessing I should do something with the KeyUp, KeyDown, MouseWheel?

Overall, the scrollbar isn’t functioning. I thought if I could play with a tutorial, it might give me an idea of what I’m missing.

If you have had consulted the docs seriously, you would have seen that there is an event called ValueChanged which is specific to Scrollbar.

And there are four properties specific to the Scrollbar: LineStep and PageStep, Minimum and Maximum.

And if you would had checked out the examples which come with the Xojo installation, you would have seen that there is a (desktop) Scrollbar related example called CanvasScrolling.xojo_binary_project.

Really? Really.

[quote=199894:@Eli Ott]If you have had consulted the docs seriously, you would have seen that there is an event called ValueChanged which is specific to Scrollbar.

And there are four properties specific to the Scrollbar: LineStep and PageStep, Minimum and Maximum.

And if you would had checked out the examples which come with the Xojo installation, you would have seen that there is a (desktop) Scrollbar related example called CanvasScrolling.xojo_binary_project.

Really? Really.[/quote]
I don’t know who pissed in your cereal, but I hope you find closure with whatever you’re dealing with.

With all due respect, I’m still learning and this is a great community. I’m not shy to ask questions, because that’s how I learn, and others have their own approach. Thank you for bringing the example in the Xojo installation to my attention. I’ll investigate that.

Besides the docs, always check the examples. Almost everything is covered in them. One learns most by studying code.

Maybe I have my Sir Tim Hunt day?

I bet you forgot to use the scrollbar value somewhere. Posting what you got would help helping you.

@Michel Bujardet
I found a very helpful tutorial. The one in the Xojo installation package was good as well, but I found myself benefiting more from my newest find.

I developed a practice scrollbar program, but there’s one problem. When I click the scroll down button, the scrollbar doesn’t stay in a fixed place. It moves up, and becomes less seen, as the page is scrolled. I’ve been working on this for a while now, and if you have any input that would be great. Here’s my file. ScrollBar Practice

The Scrollbar is ON the Canvas. So as the scrollbar moves the canvas the scrollbar is moving with it too.

Move the scrollbar off the Canvas, shrink the Canvas a bit then reposition the scrollbar just to the right of the Canvas. Then the scrollbar will stay in it’s position.

Some more suggestions…

  1. Move scrollbar off canvas, as mentioned

  2. Set cnavas alignment to top-left-right :
    so it takes all canvas width if that is ever resized

  3. Set scrollbar alignement to top-bottom-right :
    so it resizes with container and stays on right

  4. Wherever you place the container on your window,
    align it top-bottm-left-right

Good luck

In addition to Chris’ suggestions (where point 2 is the most important: don’t lock the bottom of the canvas):

Add this event to Canvas1:

Function MouseWheel(X As Integer, Y As Integer, deltaX as Integer, deltaY as Integer) As Boolean ScrollBar1.Value = ScrollBar1.Value + deltaY End Function

Add this event to Scrollbar1:

Function MouseWheel(X As Integer, Y As Integer, deltaX as Integer, deltaY as Integer) As Boolean Me.Value = Me.Value + deltaY End Function

You will have to play with deltaY to get smooth scrolling, I often use 0.5 * deltaY.

[quote=200020:@Will Shank]The Scrollbar is ON the Canvas. So as the scrollbar moves the canvas the scrollbar is moving with it too.

Move the scrollbar off the Canvas, shrink the Canvas a bit then reposition the scrollbar just to the right of the Canvas. Then the scrollbar will stay in it’s position.[/quote]

It’s always the little things. Thanks Will for bringing that to my attention. Also, thank you @Chris Carter and @Eli Ott for your helpful suggestions. I’ll be home soon and I’ll give it a try.

It works smoothly! Thanks for all the support and help. There were many answers to my question, but unfortunately I can only choose one. Thank you again!!