flat assembler
Message board for the users of flat assembler.

Index > DOS > Scroll bar?

Author
Thread Post new topic Reply to topic
me239



Joined: 06 Jan 2011
Posts: 200
me239
Hello, I'm trying to make a DOS file viewer with a single stationary window and a scrollbar, my only problem is how do I make the scroll bar work? How do I save the current files displayed and then display the next? Please help.
Post 10 Feb 2011, 23:01
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
a scroll bar with mouse or without mouse?

with mouse it is a little more complicated than without because there is a need of 2 adjustments, one for the "cursor of the scroll bar" to "first line of text to display", and one for "first line to display" to cursor of scroll bar". if you don't do that, your cursor will not be accurate to the real position, like the volume cursor in vlc 0.8.6i for example, where the cursor is one pixel behind mouse cursor above 59%

without is very simple, take the keys from keyboard, and change Y coordinate of the cursor.
this coordinate can be a percentage of the total scroll bar, or just a relative coordinate to the top of scroll bar, with a limit wich is "scroll bar lengh" - "cursor lengh".

did you tryed to draw your scroll bar theory before to ask here?
because just with a single drawing, showing variables for the scroll bar and math relation between all them will give you the solution.
Post 11 Feb 2011, 09:48
View user's profile Send private message Visit poster's website Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239
edfed wrote:
a scroll bar with mouse or without mouse?

with mouse it is a little more complicated than without because there is a need of 2 adjustments, one for the "cursor of the scroll bar" to "first line of text to display", and one for "first line to display" to cursor of scroll bar". if you don't do that, your cursor will not be accurate to the real position, like the volume cursor in vlc 0.8.6i for example, where the cursor is one pixel behind mouse cursor above 59%

without is very simple, take the keys from keyboard, and change Y coordinate of the cursor.
this coordinate can be a percentage of the total scroll bar, or just a relative coordinate to the top of scroll bar, with a limit wich is "scroll bar lengh" - "cursor lengh".

did you tryed to draw your scroll bar theory before to ask here?
because just with a single drawing, showing variables for the scroll bar and math relation between all them will give you the solution.
I want to do it without the mouse for now. My real question is how I update the screen without having to re-run the file function each time. And also, if I must run the function each time, how do I make it so it picks up where it left off? Thanks Smile
Post 11 Feb 2011, 21:18
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Why not just have a buffer and write the names to buffer from the DTA Buffer.
The names are 13bytes long so copy from the DTA Buffer to your main buffer and add 13 byte to the pointer untill your buff is fill or theres no more files.

That way you just move the start offset in the buff up and down *13.
And display them to screen.
Post 11 Feb 2011, 22:30
View user's profile Send private message Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239
Dex4u wrote:
Why not just have a buffer and write the names to buffer from the DTA Buffer.
The names are 13bytes long so copy from the DTA Buffer to your main buffer and add 13 byte to the pointer untill your buff is fill or theres no more files.

That way you just move the start offset in the buff up and down *13.
And display them to screen.
What my function already does is search for the files using the *.* wildcard and displays them straight from the DTA. I haven't thought using a buffer though. Thanks Smile
BTW, I think file name are only 11 bytes (8 byte file name, and 3 byte extension)
Post 12 Feb 2011, 04:15
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
me239 wrote:
BTW, I think file name are only 11 bytes (8 byte file name, and 3 byte extension)
See Ralf Brown Interrupt List 'FINDFIRST'
http://www.ctyme.com/intr/rb-2977.htm#Table1626
Quote:

---all versions, documented fields---
15h BYTE attribute of file found
16h WORD file time (see #01665 at AX=5700h)
18h WORD file date (see #01666 at AX=5700h)
1Ah DWORD file size
1Eh 13 BYTEs ASCIZ filename+extension


Remember you can have "." and zero at end Wink
Post 12 Feb 2011, 17:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.