Solved

Blinking item in TListView

Posted on 2004-08-03
3
279 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

20 Experts available now in Live!

Get 1:1 Help Now