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 Enable / disable single items in a TRadioGroup 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
28-Aug-02
Category
VCL-General
Language
Delphi 2.x
Views
96
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How can I set single Items.Strings in RadioGroups to Enabled := True or Enabled := 
False ?

Answer:

Solve 1:

1   TControl(RadioGroup1.Components[0]).Enabled := false;
2   TControl(RadioGroup1.Components[1]).Enabled := true;



Solve 2:

This function allows you to modify TRadioButtons in a given RadioGroup. Of course 
you can modify this to search not for a caption but for an index:
3   
4   function ButtonOfGroup(rg: TRadioGroup; SearchCaption: string): TRadioButton;
5   var
6     i: Integer;
7   begin
8     Result := nil;
9     for i := 0 to rg.ComponentCount - 1 do
10      if (rg.Components[i] is TRadioButton) and
11        (CompareStr(TRadioButton(rg.Components[i]).Caption, SearchCaption) = 0) then
12      begin
13        Result := TRadioButton(rg.Components[i]);
14        Break;
15      end;
16  end;



Solve 3:

The following code shows how to disable or enable an individual radio button in a 
TRadioGroup component (the second radio button in this case). Note that the 
RadioGroup.Controls is a zero based array.
17  
18  procedure TForm1.Button1Click(Sender: TObject);
19  begin
20    TRadioButton(RadioGroup1.Controls[1]).Enabled := False;
21  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