Solved

TListbox OnMeasureItem problems

Posted on 1998-03-03
6
358 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
Comment Utility
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
Comment Utility
I'll try it...
0
 

Expert Comment

by:bijoyn
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

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

Author Comment

by:bcrotaz
Comment Utility
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
Comment Utility
Hehe, as long as it works, don't fix it...

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now