News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Problem: Getting a scrollbar to appear in a custom control

Started by NoCforMe, August 27, 2022, 02:39:36 PM

Previous topic - Next topic

zedd151

Well, it's getting movement. Which means the control is receiving messages for it. That's a start at least. Are you also going to use a vertical scroll bar once you have mastered the 'mechanics' of how they work and how to properly implement them?

NoCforMe

No, no vertical scrollbar. This control is meant to mimic the behavior of the listview controls used in the GetOpenFilename() and GetSaveFilename() dialogs, which only use a horizontal scrollbar. (I could certainly put in a v-bar if I wanted to.) No need for a vertical one since the height of the control is fixed.

It's more than a "start"--this is fully-functional scrolling. Notice how the content of the control scrolls? I've pretty much mastered their operation (except for thumb-tracking; that's for V. 2.0). it's not that complicated: Windows does most of the heavy lifting for you.
Assembly language programming should be fun. That's why I do it.

zedd151

Quote from: NoCforMe on August 30, 2022, 03:25:56 PM
It's more than a "start"--this is fully-functional scrolling.
More than what I could do with one. I've given up on them many moons ago.

NoCforMe

Quote from: Swordfish on August 30, 2022, 03:43:28 PM
Quote from: NoCforMe on August 30, 2022, 03:25:56 PM
It's more than a "start"--this is fully-functional scrolling.
More than what I could do with one. I've given up on them many moons ago.

You just need to understand the relationship between the "range" (the difference betwixt min and max positions) and the "page" size. After that everything falls into place.

Here's a good explanation.
Assembly language programming should be fun. That's why I do it.

zedd151


Wait a minute. First you said...
Quote
* Dragging the thumb is not implemented yet, but...
From this post, But now you say:
Quote from: NoCforMe on August 30, 2022, 03:25:56 PM
It's more than a "start"--this is fully-functional scrolling.
but also from that same post:
Quote (except for thumb-tracking; that's for V. 2.0)

So yes, it is only started. The only thing seem to work are the arrow buttons "<" and ">" from what I can see. Not fully functioning unless the thumb tracking also works. :biggrin:  Sorry to nitpick. I'm sure when it's really finished (meaning no further adjustments needed) it will be fine.

NoCforMe

The "page" scrolling function also works (clicking in the bar in the space between the thumb and the buttons); this is normally implemented as "scroll-by-page", and clicking on the button is "scroll-by-line". I've made them work the same (scroll by one column), the same as the listview in the GetOpenFilename() dialog.

So the only thing that's not implemented is thumb tracking. So yes, technically not complete, but pretty close. (Oh, and there's no keyboard interface yet.)
Assembly language programming should be fun. That's why I do it.

zedd151

Quote from: NoCforMe on August 31, 2022, 05:53:27 AM
So yes, technically not complete, but pretty close.
:biggrin:   Ok, semantics aside I think you're doing a good job. You're more persistent than I would be. After the first fail or two I usually give up.

NoCforMe

So let me pose a li'l challenge to you (when you've got the time and inclination, of course): write a little something that incorporates a working scrollbar in some control. You can do it if you try.
Assembly language programming should be fun. That's why I do it.

zedd151

Does writing an editor that uses rich edit and its embedded scroll bar count?  :tongue:
If not, then I'll pass thanks.
I still may, one day...
I remember the first attempt back in maybe 2006-7 I got the scroll bar into the window but didn't do anything.
The thumb button moved up and down (vertical SB) but no reaction to the action. I played with it for a few daze. :undecided:

NoCforMe

You have to keep in mind that the scrollbar is only a graphical representation of what's supposed to be displayed in your window. The scrollbar itself doesn't scroll your contents: that's on you, usually in your WM_PAINT handler. It merely sets a starting point for the display of whatever's in the window, text, graphics, whatever. Once you understand that, it's not that hard.

Once you figure out how SetScrollInfo() works, you're in business.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: Swordfish on August 31, 2022, 07:08:03 AM
Does writing an editor that uses rich edit and its embedded scroll bar count?  :tongue:

No, doesn't count, because the RichEdit control handles the scrollbar itself, no need for intervention :tongue:

zedd151

Quote from: jj2007 on August 31, 2022, 07:52:00 AM
Quote from: Swordfish on August 31, 2022, 07:08:03 AM
Does writing an editor that uses rich edit and its embedded scroll bar count?  :tongue:

No, doesn't count, because the RichEdit control handles the scrollbar itself, no need for intervention :tongue:
:biggrin:

NoCforMe

Same thing with a plain old edit control that uses the ES_AUTOHSCROLL or ES_AUTOVSCROLL styles, which bring up scrollbars automagically as needed.
Assembly language programming should be fun. That's why I do it.

zedd151


Quote from: NoCforMe on August 31, 2022, 07:33:46 AM
Once you figure out how SetScrollInfo() works, you're in business.
I'll look at it one of these daze. Haven't really had the need, but would be nice to know though. And progress bars too :tongue:
We've got bad thunderstorms here internet acting flaky. So if I disappear for a while....
I had this reply on the clipboard, the internet went down.  :sad:  It's up now but for how long?

hutch--

List and Combo boxes will set scroll bars as well if you use the right styles with them.  :biggrin: