FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Custom scrollable control and ScrollWindow call

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
Al



Joined: 10 Mar 2008
Posts: 9

PostPosted: Tue Mar 25, 2008 12:47 pm    Post subject: Custom scrollable control and ScrollWindow call Reply with quote

Hi there!

I want to create a custom list view control, so I have decided to subclass ScrollableControl or ContainerControl (which seems to be only slightly different).

On top of my control I would like to have column headers, unaffected by scrolling (i.e. they have to stay on top, no matter what - just like the standard list view).

Okay, the question is - ScrollableControl calls ScrollWindow when handling WS_VSCROLL / WS_HSCROLL, and AFAIK this function "scrolls the contents of the specified window's client area" simply by copying already drawn image to the new location. How, then, do I keep my column headers where they're supposed to be drawn?

Setting ContainerControl as a parent for other controls doesn't seem to help either - I've tried this with a button, and it just scrolls away as I manipulate the scroll bar.

Any ideas? Sad


P.S. Well, I can remove those ScrollWindow calls and recompile DFL, of course. I've tried it already, and it IS a solution, albeit not a very elegant one. In fact, I really dislike this idea. And there might be legal implications, too (not sure if the license allows such modifications). And
when the next version of DFL comes out, then what? Especially if ScrollableControll will be modified in the next version.
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Thu Mar 27, 2008 1:52 pm    Post subject: Re: Custom scrollable control and ScrollWindow call Reply with quote

Some ideas:
* Use separate controls for the header and the contents; can even wrap this up in another control.
* Reposition the header in the layout event.
* Implement your own scrolling code.
* Another way might be to change the nonclient dimensions of the control to exclude this header area, and put your header stuff up there. This needs WM_NCCALCSIZE and can be tricky.
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Thu Mar 27, 2008 2:03 pm    Post subject: Re: Custom scrollable control and ScrollWindow call Reply with quote

Some notes:

I think WM_NCCALCSIZE is what the standard ListView does.

I don't think the way ScrollableControl scrolls the controls is wrong. You're trying to do something out of the norm, so it's not quite as easy. Making custom controls can be tricky.

For the separate controls idea, I meant not having the header be a child of your list control, they would be siblings, and then wrapped in a control representing both.

I thought of another possible way: handle WM_WINDOWPOSCHANGING and prevent it from moving from 0,0.

Also note that I think it won't look right unless you either use separate controls or WM_NCCALCSIZE, because the content scrollbar would go up alongside the header, which probably isn't desirable.
Back to top
View user's profile Send private message
Al



Joined: 10 Mar 2008
Posts: 9

PostPosted: Fri Mar 28, 2008 7:24 am    Post subject: Reply with quote

Thank you, Chris, you really gave me something to think about..

I guess, re-implementing scrolling support from scratch in a Control-derived class wouldn't be too hard. After all, while trying to find out what goes wrong (and how scrolling is supposed to work in the first place), I have already done it, albeit in pure C/Win32 API Wink

I was just hoping I would be able to avoid duplicating already existing code (in ScrollableControl). Oh well.. Rolling Eyes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group