Solved

Blinking item in TListView

Posted on 2004-08-03
3
285 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

691 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