Solved

TListbox OnMeasureItem problems

Posted on 1998-03-03
6
369 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

808 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