Re: CListCtrl, hide and edit



Joe,

Good point about the zero sized row.

I already provide all the data to the list control via the callback
OnGetdispinfoList(). I set the Owner Data attribute without changing
anything else. Apparently the lParam is no longer stored in the item so my
program displays the first item in each location. I can use the iItem number
instead to solve that and it looks correct. Sorting gives an ASSERT now but
that depends on lParam too so it's not surprising. However, how do I solve
that because I can't get at the iItem number in the compare function.

Also, how do I deal with the number of items in the list control? I could
imagine I just set the size of the list to the total number of items I
should be displaying. It should be fast to do that - the control just
allocates or deallocates memory. Is that correct?

Lastly, is it possible to edit a list control subitem in place? If not, what
is the purpose of EditLabel()? Oh wait. I set Edit Labels. Now I can get an
in place edit of the first column. How can I do the other columns?

Thanks,

Bill


"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:g8at14dqekitbjphp1ot3g1f2mpfsogssh@xxxxxxxxxx
You can't show/hide elements of a CListBox or CListCtrl. Note that making
the size 0 will
just confuse the user who might be using arrow keys to move up and down.

Look into virtual listboxes or virtual list controls. You don't need to
keep re-adding
everything
joe

On Mon, 5 May 2008 07:28:29 +0800, "Bill Brehm" <don't want spam> wrote:

Dave,

Your idea was my plan B. Problem is I have a lot of items in my list so
deleting everything out and re-adding everything takes quite some time.
That's why I was looking for a plan A. Are you saying I guess that there
is
no way to hide items or size a row?

Is there a way to edit in place?

Thanks,

Bill


"David Webber" <dave@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eJ9gLqgrIHA.5096@xxxxxxxxxxxxxxxxxxxxxxx

"Bill Brehm" <don't want spam> wrote in message
news:OFHl1RfrIHA.4544@xxxxxxxxxxxxxxxxxxxxxxx

MFC 6.0. The Help implied that I can hide an item in a CListCtrl. But I
can't find out how to do it. I'd like to be able to fill a CListCtrl
with
a set of data, then filter to show only a subset by hiding all those
items not in the subset.

Also, GetEditControl() implies (to me at least) that I can get a CEdit
pointer edit an item (or subitem?) in a CListCtrl. But I can't see how
to
specify the item or subitem to be edited. I have a different CListCtrl
with a number of items that I would like to edit in place to allow the
user to configure something.

Thanks for any suggestions.

In circumstances like this I

- derive my own class from CListBox
- store in it a collection of ALL objects which can be selected (usually
in a vector)
- add to the list box only those which need to be seen.
- in particular I put the text I want to show in the list item, and
store
a pointer to the corresponding object as the list item's data.

When the set of objects I want to show changes, I

- empty everything out of the list,
- add the new set of objects I want to show in the same way.

HTH

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm



Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


.



Relevant Pages

  • Re: CListCtrl, hide and edit
    ... In a virtual control, indeed, there is no data storage at all. ... how do I deal with the number of items in the list control? ... I set Edit Labels. ... Due to fundamental failures of design, a CListCtrl only allows the editing of the 0th ...
    (microsoft.public.vc.mfc)
  • Re: How to get window pointer to dialog
    ... >edit control to the list control (whether it is child or not doesn't matter ... >> GetParent (actually MFC is but it is a result of my request to set focus). ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: How to get window pointer to dialog
    ... If you create the Edit control as a child window (would be smart, ... edit control to the list control (whether it is child or not doesn't matter ... A CWnd pointer is passed in. ...
    (microsoft.public.vc.mfc)
  • How to get window pointer to dialog
    ... I have a dialog with a list control. ... GetParent (actually MFC is but it is a result of my request to set focus). ... What is happening is I dynamically create an edit box and layer it on the ... A CWnd pointer is passed in. ...
    (microsoft.public.vc.mfc)
  • Re: OnMeasureItem
    ... > owner drawn, you won't get any WM_MEASUREITEM messages. ... >> creates a CListCtrl who subclasses a CHeaderCtrl. ... >> CWnd that created the list control, but then I couldn't get a dockable ... >> toolbar, so I went this more cumbersome route to get the toolbar and ...
    (microsoft.public.vc.mfc)

Loading