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 determine which combinations of rows and columns have been checked off i 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
27-Aug-02
Category
VCL-General
Language
Delphi All Versions
Views
111
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas 

I have a form with checkboxes in 8 rows and 7 columns. I want to be able to 
determine which combinations of rows and columns have been checked off. Is the best 
way to do this using a 2-D array? How would I declare this array for the checkboxes?

Answer:

1   FArray: array[0..7, 0..6] of TCheckBox;
2   
3   //You also you have to create Checkboxes at runtime, like:
4   
5   FArray[i, j] := TCheckBox.Create(Self);
6   
7   I would suggest to use the Tag property instead. Assign the same OnClick event 
8   handler to all checkboxes and code the Tag for each checkbox. Say 23 (second 
9   column, third row), you know like matrix indices in math:
10  
11  ....OnClick(Sender: TObject);
12  var
13    ATag: Integer;
14  begin
15    if (Sender is TComponent) then
16    begin
17      ATag := TComponent(Sender).Tag;
18      ShowMessage(Format('Column %d, Row %d', [ATag div 10, ATag mod 10]));
19    end;
20  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