?? activeradiobutton.pas
字號:
////////////////////////////////////////////////////////////////////////////////
//
//
// FileName : ActiveRadioButton.pas
// Creator : Shen Min
// Date : 2002-06-26
// Comment :
//
//
////////////////////////////////////////////////////////////////////////////////
unit ActiveRadioButton;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, ActiveButton,
ActiveCheckBox;
type
TActiveRadioButton = class(TActiveCheckBox)
private
FGroupIndex : Integer;
procedure UnCheckGroup();
protected
procedure SetChecked(const Value: Boolean); override;
procedure Click(); override;
procedure DblClick(); override;
published
property GroupIndex : Integer read FGroupIndex write FGroupIndex default 0;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Sunisoft', [TActiveRadioButton]);
end;
procedure TActiveRadioButton.Click;
begin
inherited;
Checked := true;
end;
procedure TActiveRadioButton.DblClick;
begin
inherited;
Checked := true;
end;
procedure TActiveRadioButton.SetChecked(const Value: Boolean);
begin
if Value and (not Checked) then
UnCheckGroup();
inherited;
end;
procedure TActiveRadioButton.UnCheckGroup;
var
i : Integer;
begin
if Parent = nil then
Exit;
for i := 0 to Parent.ControlCount - 1 do
begin
if not (Parent.Controls[i] is TActiveRadioButton) then
continue;
if Parent.Controls[i] = self then
continue;
if (Parent.Controls[i] as TActiveRadioButton).GroupIndex <> GroupIndex then
continue;
(Parent.Controls[i] as TActiveRadioButton).Checked := false;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -