English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. C/C++ (https://eab.abime.net/forumdisplay.php?f=118)
-   -   How do you get scrollbars to work in C? (https://eab.abime.net/showthread.php?t=88766)

chocsplease 24 September 2017 14:46

How do you get scrollbars to work in C?
 
Dear all,

As you probably know by now I am trying to build an app to output some info to a window. I have got to the stage where I can put the text into the window and allow the user to resize and move it, updating the window as necessary.

I now want to add a horizontal and vertical scroll gadget so that the user can scroll the text if the window is smaller than the data in it.

There is a thread here -> http://eab.abime.net/showthread.php?...=scroll+gadget on these forums showing how to do it in assembler but I cannot find any information as to how to do it in c.

So far I think you need to set up a list of your gadgets and pass this to something and then watch for various signals. I'm already doing the latter for the resize so have a good handle on these - although I am not sure which signals to look for, or what tags I need to add to my open window.

Could someone point me at an easy to follow example for setting up and reading the status etc of a horizontal and vertical scroll bar in C?

Many thanks.

thomas 24 September 2017 18:40

1 Attachment(s)
Here is a full working example. Not sure if it helps, it lacks any comments.

chocsplease 30 October 2017 22:29

Hi Thomas,

Many thanks for the code and sorry for not replying sooner. You are correct though without comments I'm doing a lot of head scratching. Is it OK if I come back asking about the bits I'm stumped on?

thomas 31 October 2017 14:54

1 Attachment(s)
I added comments to the source code already some time ago. But without any feedback from you I didn't bother to upload it.

Of course you are welcome to ask about anything you don't understand.

Note: the tabulator size in my code is 4. The comments and indention might look a bit unaligned if you use a different tab size.

S0ulA55a551n 01 November 2017 12:56

Quote:

Originally Posted by thomas (Post 1195984)
I added comments to the source code already some time ago. But without any feedback from you I didn't bother to upload it.

Of course you are welcome to ask about anything you don't understand.

Note: the tabulator size in my code is 4. The comments and indention might look a bit unaligned if you use a different tab size.

4 for a tab , everyone knows it should be three :)


All times are GMT +2. The time now is 23:49.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05142 seconds with 11 queries