-
February 15th, 2011, 04:32 PM
#1
CListCtrl with horizontal scroll
Dear experts,
I have an application that displays differences between two text files, something similar to comparing functionality of Visual Source Safe.
I am using a CListCtrl with two columns. Some of the lines I display may be very long. Such lines are not displayed in full, but part of them is replaced with "..."
Could you please tell me how I could have horizontal scrollbars in each column?
Also, how could I make both scrollbars work synchronously to make comparison easier, so that dragging one scroll would automatically move another one?
Thanks.
-
February 15th, 2011, 04:41 PM
#2
Re: CListCtrl with horizontal scroll
Originally Posted by dpreznik
I am using a CListCtrl with two columns. Some of the lines I display may be very long. Such lines are not displayed in full, but part of them is replaced with "..."
Could you please tell me how I could have horizontal scrollbars in each column?
Try CListCtrl::SetColumnWidth with LVSCW_AUTOSIZE parameter
Victor Nijegorodov
-
February 15th, 2011, 04:49 PM
#3
Re: CListCtrl with horizontal scroll
I tried that, but in that case the columns have almost no width at all, only to squeeze there one character.
-
February 16th, 2011, 05:40 AM
#4
Re: CListCtrl with horizontal scroll
The CListCtrl doesn't offer this feature. you can't have a scrollbar inside a column.
An ownerdraw listcontrol and a lot of twiddly code could probably make this work, but.
you'll probably have noticed that most of the apps doing this kind of side by side comparison use 2 individual listcontrols and just synchronise them to display "the same" lines. Doing it that way is a lot simpler.
-
February 16th, 2011, 08:04 AM
#5
Re: CListCtrl with horizontal scroll
Could you please tell me how I can synchronized scrolls in case of 2 list controls? I would need to synchronized both vertical and horizontal scrolls. Thanks.
-
February 17th, 2011, 08:11 AM
#6
Re: CListCtrl with horizontal scroll
handle the WM_HSCROLL and WM_VSCROLL messages.
figure out what position you're at, then set the position for the other listcontrol.
you can also do it with just 1 vertical scrollbar.
in that case the right one has the scrollbar, do the same, trap WM_VSCROLL only on the right listcontrol. use a "virtual list" approach on the left one. basically the left list doesn't have stored lines, you make the listcontrol ask for contents as you go. the listcontrol basically has as many virtual items as it can display so it doesn't display a scrollbar.
If you wanna go this road, just make it work with a normal filled listcontrol on the left first, only handle WM_VSCROLL in the right list. Add the virtual list concept lateron.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|