Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to simulate an OnCheck event for TListView checkboxes Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
31-Oct-02
Category
VCL-General
Language
Delphi 2.x
Views
80
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I am working on a program that uses a TListView with the checkboxes property set to 
true. There are several things I would like to be triggered off of the boxes being 
checked or unchecked. Is there any OnCheck event or something similar that I can 
use to start a process off of the check of one of these boxes?

Answer:

It seems, there isn't such event. But you could use this workaround:
1   
2   procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
3     Shift: TShiftState; X, Y: Integer);
4   var
5     li: TListItem;
6     ht: THitTests;
7   begin
8     if ListView1.Items.Count <= 0 then
9       exit;
10    li := ListView1.GetItemAt(x, y);
11    if Li <> nil then
12    begin
13      if li.Selected = false then
14        li.Selected := true;
15    end
16    else
17      exit;
18    ht := LVSoLine.GetHitTestInfoAt(x, y);
19    if ht = [htOnStateIcon] then
20    begin
21      { Write your code here for checkbox OnCheck event. Remember this will
22      fire after the checkbox state is changed }
23    end;
24  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC