Solved

TListbox OnMeasureItem problems

Posted on 1998-03-03
6
376 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
Technology Partners: 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 100 total points
ID: 1360056
Hehe, as long as it works, don't fix it...

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 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