English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 24 September 2017, 14:46   #1
chocsplease
Registered User

 
Join Date: Dec 2016
Location: london
Posts: 157
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.
chocsplease is offline  
AdSense AdSense  
Old 24 September 2017, 18:40   #2
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,661
Here is a full working example. Not sure if it helps, it lacks any comments.
Attached Files
File Type: c scroller.c (6.8 KB, 70 views)
thomas is offline  
Old 30 October 2017, 22:29   #3
chocsplease
Registered User

 
Join Date: Dec 2016
Location: london
Posts: 157
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?
chocsplease is offline  
Old 31 October 2017, 14:54   #4
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,661
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.
Attached Files
File Type: c scroller.c (12.9 KB, 35 views)
thomas is offline  
Old 01 November 2017, 12:56   #5
S0ulA55a551n
Registered User
S0ulA55a551n's Avatar
 
Join Date: Nov 2010
Location: Rhondda, Wales
Age: 41
Posts: 498
Quote:
Originally Posted by thomas View Post
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
S0ulA55a551n is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
does it work everywhere or not meynaf Coders. Asm / Hardware 1 28 June 2016 23:32
How do I get F4 to work? mrvp support.FS-UAE 3 30 August 2015 20:31
would this work? lost_loven support.Hardware 6 23 September 2010 00:55
Can this two work together? Frikic support.Hardware 5 05 February 2010 21:33
Please help me ( I just can´t get it to work ) eZRo support.WinFellow 9 09 July 2005 16:51

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:04.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06435 seconds with 16 queries