Solved

Blinking item in TListView

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

0
Comment
Question by:faustomen
[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
  • 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

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.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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