Solved

Blinking item in TListView

Posted on 2004-08-03
3
282 Views
Last Modified: 2010-04-05
How may I blink a specific item in TListView?

0
Comment
Question by:faustomen
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Colin_Dawson earned 125 total points
ID: 11705519
You need to make your own drawing routine for the TListview.  Take a look at OnDrawItem,  then you'll need to add a TTimer, that will control the blinking.  don't use .Paint, but use .invalidate to ask the TListview to re-draw.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 11708365

Something like the following will allow you to "blink" (it inverts the image)  the list item without having to use a timer, and without having to implement owner-drawing. May make things a little easier to implement....

Regards,
Russell

procedure BlinkListItem(Item: TListItem);
var  hdcPaint:      HDC;
      rcBounds:      TRect;
begin

  // Check assignment
  if Assigned(Item) then
  begin
     // Get the bounds rect for the item
     rcBounds:=Item.DisplayRect(drBounds);
     // Get the window DC
     hdcPaint:=GetDC(Item.Handle);
     // Invert the item
     Assert(InvertRect(hdcPaint, rcBounds), 'Failed to invert the rectangle');
     // Release the dc
     ReleaseDC(Item.Handle, hdcPaint);
     // Validate the item rectangle
     ValidateRect(Item.Handle, @rcBounds);
     // Delay
     Sleep(500);
     // Have the item repaint
     InvalidateRect(Item.Handle, @rcBounds, True);
  end;

end;

0
 
LVL 4

Expert Comment

by:Colin_Dawson
ID: 11743720
I'm glad that I gave you enough information to be able to solve this problem.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

17 Experts available now in Live!

Get 1:1 Help Now