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

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


How to change listbox styles on the fly

John Margaglione -- tenor@xnet.com
Sunday, January 21, 1996

I am trying to change a listbox from sorted to unsorted and back using =
popup menus.  I can't seem to get this to work.  I am calling the =
listbox's ModifyStyles method followed by the listbox's RedrawWindow =
method.  No dice.  What am I missing?



Niels Ull Jacobsen -- nuj@kruger.dk
Tuesday, January 23, 1996

> 
> I am trying to change a listbox from sorted to unsorted and back using =
> popup menus.  I can't seem to get this to work.  I am calling the =
> listbox's ModifyStyles method followed by the listbox's RedrawWindow =
> method.  No dice.  What am I missing?

I think this is in the FAQ. It can't be done. Once you have created
the list box, it's sorted. You have three options.

1. Make two listboxes, one sorted and one unsorted and switch between
them by making the non-current invisible and disabled. Make sure to
keep the selection in sync when switching. I recommend this.

2. When switching, you destroy the old listbox and make a new one.

3. If you for some insane reason insist on having only one listbox:
Make it ownerdrawn and sort it appropriatly in your WM_COMPAREITEM
handler. When you change state, loop through all the items and remove
and add those which are out-of-order. You can keep the sort key for
the "unsorted" state in the ITEMDATA field.

--
Niels Ull Jacobsen, Kruger A/S

Everything stated herein is THE OFFICIAL POLICY of the entire Kruger
group and should be taken as legally binding in every respect. Pigs
will grow wings and fly.









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