Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.02.11;
Скачать: CL | DM;

Вниз

OnMeasureItem и Items.Objects   Найти похожие ветки 

 
ZeK   (2006-12-15 10:56) [0]

Задача постороить список с варьируемой высотой пунктов. Высота вычисляется из значений связанного объекта. Но в событии OnMeasureItem Items.Objects[I] равен nil. Можно конечно передать адрес через
Items.Add(IntToStr(Cardinal(Object)))
но программа критична ко времени, не подходит. Что делать?


 
MBo ©   (2006-12-15 11:10) [1]

Yes, this is an old problem caused by the fact that the AddObject method
internally has to send two messages to the Windows listbox control. The
first creates the item and sets it text, the second stores the object into
the item. Unfortunately it is the first message (LB_ADDSTRING or
LB_INSERTSTRING) that causes the WM_MEASUREITEM message to be send back, so
the object has not been stored yet when the OnMeasureItem event fires.

The best way to fix this is to simply ignore the OnMeasureItem event.
Instead you measure the item immediately after the AddObject call and send a
LB_SETITEMHEIGHT message to the listbox to tell it the height.

Peter Below


 
ZeK   (2006-12-15 11:54) [2]

Cool, thank you very match (На этом мой англ. заканчивается :).


 
MBo ©   (2006-12-15 13:15) [3]

>На этом мой англ. заканчивается
Ну смысл-то понял?


 
Nostradamus ©   (2006-12-15 21:09) [4]

Перед добавлением просто пиши в переменную что добавил и оттуда пери значения в OnMeasureItem


 
ZeK   (2006-12-15 22:58) [5]

2 MBo ©
Понял :)
2 Nostradamus ©
Я использую BeginUpdate/EndUpdate, из-за большого размера списка. Поэтмоу через переменную неполучится



Страницы: 1 вся ветка

Текущий архив: 2007.02.11;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.044 c
15-1168979975
DevilDevil
2007-01-16 23:39
2007.02.11
Отказаться от обновления Рамблеровской Аськи?


8-1150563709
Denister
2006-06-17 21:01
2007.02.11
конвертировать RTF в простой текст (без VCL)


2-1169642085
Garacio
2007-01-24 15:34
2007.02.11
два TiniFile.Create = Access violation


15-1169415457
Kerk
2007-01-22 00:37
2007.02.11
Skype пытается отобрать домен skype.tv за $75


15-1169024822
lookin
2007-01-17 12:07
2007.02.11
ICQ с телефона