?
Solved

TListbox OnMeasureItem problems

Posted on 1998-03-03
6
Medium Priority
?
385 Views
Last Modified: 2012-05-04
The OnMeasureItem event is only called when a new item is added.  Can it be set up to call it every time it is Invalidated?

My items change height a lot.  They cause the listbox to be repainted.  At the moment I have to cheat and set and unset a visual property to force a new measurement.  This results in a huge flicker.

eg.

Listbox.Ctl3d:=False;
Listbox.Ctl3d:=True;

Hmmm..
There must be an easy way round this!

Bryan
0
Comment
Question by:bcrotaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1360051
I haven't tried this, but it may work:
  LockWindowUpdate(YourMainForm.Handle);
  ListBox.Ctl3d := False;
  ListBox.Ctl3d := True;
  LockWindowUpdate(0);

JB
0
 
LVL 1

Author Comment

by:bcrotaz
ID: 1360052
I'll try it...
0
 

Expert Comment

by:bijoyn
ID: 1360053
Have u tried using the OnDrawItem instead of OnMeasureItem. I am not sure what exactly u are doing with the height of the items in the Listbox but OnDrawItem will be called every time u select a Item or scroll through the Item. Addtionally this event is called when u call the Listbox's Invalidate  method.

Bijoy
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:bcrotaz
ID: 1360054
I am using OnDrawItem to draw the items.  OnMeasureItem enables you to have variable height items.
0
 
LVL 1

Author Comment

by:bcrotaz
ID: 1360055
JimBob - can you send an answer?
That works perfectly - A bodge, but a working bodge!
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 400 total points
ID: 1360056
Hehe, as long as it works, don't fix it...

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question