15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CListCtrl vs. CListView usage

Andi Giri -- agiri@ctiis.com
Monday, June 24, 1996

My environment is : Visual C++ 4.1, MFC 4.1 / WIN 95

I am developing a 32-bit MDI application, with the view 
derived from CFormView.  The form for the view has two 
list boxes in the top and a few static text controls 
(LTEXT in the .RC file) in the bottom half.

I am working on converting the two list boxes in the top half to
CListCtrl controls, so that the user can resize the columns at his will
and pleasure.

I see that I could use either CListCtrl or CListView, but
I would prefer to keep CFormView itself, and just use CListCtrl instead
of CListBox.  Will there be any problems?  Do I have to do anything
special, while painting, scrolling, etc.?
Any samples would be appeciated.

Andi Giri




Kevin_L_McCarthy.IACNET@ngate.zis.ziff.com
Tuesday, June 25, 1996

[Mini-digest: 2 responses]

Andi,

The main difference between CListView and CListCtrl is in where messages go. 
The CListView will automatically recieve any of the messages you want to 
handle. A CListCtrl might require you to use reflected messages in some cases. 
If you are not trying to do anything fancy to the controls, and only want to 
provide standard functionality, I think CListCtrl is the way to go. You do have 
two of them, after all, in the same view. Even if you end up doing some 
customization, reflection works quite well for the NOTIFY messages you will 
need. 

Kevin McCarthy
-----From: "Frederic Steppe" 

>My environment is : Visual C++ 4.1, MFC 4.1 / WIN 95
>
>I am developing a 32-bit MDI application, with the view 
>derived from CFormView.  The form for the view has two 
>list boxes in the top and a few static text controls 
>(LTEXT in the .RC file) in the bottom half.
>
>I am working on converting the two list boxes in the top half to
>CListCtrl controls, so that the user can resize the columns at his will
>and pleasure.
>
>I see that I could use either CListCtrl or CListView, but
>I would prefer to keep CFormView itself, and just use CListCtrl instead
>of CListBox.  Will there be any problems?  Do I have to do anything
>special, while painting, scrolling, etc.?

CListView is designed to be a view build around a list control.  In your case, 
I think you have to choose between a CFormView with to list controls, or a 
CSplitterWnd containing two CListView's (you loose the statics in that case).

The resulting aspect will be quite different in both case.

It don't make any particular problem to use list controls in a CFormView.  
You'll just have a little bit more work to do than you have had with 
listboxes.

Frederic Steppe (frederics@msn.com)




| Вернуться в корень Архива |