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

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


CTreeCtrl and Scroll assertions

Jim Leavitt -- jimll@halcyon.com
Monday, February 19, 1996

Hello all:
Well I'm writing again, I'm trying to answer more questions
than I ask, but I've got another strange problem perhaps one
of you have seen.

Windows 95
VC 4.0
MFC 4
32 MB Ram

I've got a CTreeCtrl loaded with customer names (about 8 - 900).
Every once in a while, I'll get an assertion from MFC that the 
scroll position doesn't match npos. Usually, its no problem, however
today, I got some very strange visual problems, giant scroll buttons 
and a continously scrolling control.

I was sitting with over 60% free memory. I am not catching low 
memory messages from the TreeCtrl, (I'll add that). Shouldn't I be 
well within the memory limits of a TreeCtrl in general.

I went back in a added lots of redundant UpdateWindow() calls
for every expansion and contraction of the control. (members are
added dynamically).

Any insight would be much appreciated!
Jim Leavitt






Jim Leavitt -- jimll@halcyon.com
Wednesday, February 21, 1996

Thank you all for the help on the strange tree control problem I was having.
I think I've got it figured out. Mukesh Prasad's response seems to be right
on track. I was intercepting mouse down events, specifically LBUTTONDOWN
among others. 

While I was checking for the mouse position, it was still possible to get a
stray LBUTTONDOWN posted to the scroll bar of the tree control. I believe
this caused all my grief.

My fix was to:
1) post LBUTTONUP events after the LBUTTONDOWN.
2) Tighten up the screen position check before posting the message. It seems
to be working. (I now have those floating text windows above the tree
control that show the entire text of the item if its clipped.) All in all it
was rather easy to do, with just the one major hack of posting mouse message
through the balloon window to the TreeCtrl. 

I'd be glad to share this if anyone is interested. If you've implemented
balloon windows on TreeCtrls, it would be very interesting to compare note.

Thanks again
Jim Leavitt





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