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

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


Custom CListBox

Tim Philip -- philip@cs.usask.ca
Tuesday, January 02, 1996


I have written a customized CListBox which I subclass in my dialogs.

Some of the memebers of this listbox I have made invisible (ie. zero
width).  However, if the user scrolls through the list using the
keyboard it still allows him to select these invisible members.  This
also screws up scrolling a bit because it will scroll up one invisible
member with no visible change in the box.

Does anyone have any idea how to catch a selection change from inside
the a custom CListBox class?  Unfortunately, most of the CListBox
functions are non-virtual so I can't just overload them which would
solve the problem quite quickly.

I *could* catch the selection change in the dialog box
(ie. ON_LBN_SELCHANGE) and then check to see if the current item is
visible and adjust the list selection, but since I use this listbox in
numerous places this seems kind of inefficient.  There *has* to be
some way to catch this even from within my custom class.

Any suggestions would be greatly appreciated.  I'm getting really tired
of banging my head against the wall.

Thanks!

-------
Tim Philip, B.Sc.           Randco Software Corporation
Consultant                  2530 Hanover Avenue   
                            Saskatoon, SK          Phone: +1-306-343-3380
philip@cs.usask.ca          Canada   S7J 1G1         Fax: +1-306-343-3341



LeRoy Baxter -- lbaxter@cinfo.com
Wednesday, January 03, 1996

Maybe it would be more productive to re-evaluate why you
are putting invisible items in the listbox.  Perhaps you might
keep your list outside the listbox, and only put the items you
want visible in the ClistBox?

On Tuesday, January 02, 1996 6:52 AM, Tim Philip[SMTP:philip@cs.usask.ca] wrote:
>
>I have written a customized CListBox which I subclass in my dialogs.
>
>Some of the memebers of this listbox I have made invisible (ie. zero
>width).  However, if the user scrolls through the list using the
>keyboard it still allows him to select these invisible members.  This
>also screws up scrolling a bit because it will scroll up one invisible
>member with no visible change in the box.
>
>Does anyone have any idea how to catch a selection change from inside
>the a custom CListBox class?  Unfortunately, most of the CListBox
>functions are non-virtual so I can't just overload them which would
>solve the problem quite quickly.
>
>I *could* catch the selection change in the dialog box
>(ie. ON_LBN_SELCHANGE) and then check to see if the current item is
>visible and adjust the list selection, but since I use this listbox in
>numerous places this seems kind of inefficient.  There *has* to be
>some way to catch this even from within my custom class.
>
>Any suggestions would be greatly appreciated.  I'm getting really tired
>of banging my head against the wall.
>
>Thanks!
>
>-------
>Tim Philip, B.Sc.           Randco Software Corporation
>Consultant                  2530 Hanover Avenue   
>                            Saskatoon, SK          Phone: +1-306-343-3380
>philip@cs.usask.ca          Canada   S7J 1G1         Fax: +1-306-343-3341
>
>





Andrew Branch -- AndrewB@lpa.com
Thursday, January 04, 1996


> Does anyone have any idea how to catch a selection change from inside
> the a custom CListBox class?  Unfortunately, most of the CListBox
> functions are non-virtual so I can't just overload them which would
> solve the problem quite quickly.

Tim,

I think you could override the CWnd::OnChildNotify function in your list 
box.
>From here you should be able to figure out if the selection was changed.

Andrew Branch
LPA Software
abranch@lpa.com




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