You've already forked lazarus-ccr
ExCtrls: Improvements in TCheckComboBoxEx.ButtonWidth.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8138 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -39,7 +39,7 @@ type
|
||||
property State[AIndex: Integer]: TCheckboxState read GetState write SetState;
|
||||
end;
|
||||
|
||||
TCheckComboBoxEx = class(TEditButton)
|
||||
TCheckComboBoxEx = class(TCustomEditButton)
|
||||
private
|
||||
FAllowGrayed: Boolean;
|
||||
FAutoDropDown: Boolean;
|
||||
@ -61,14 +61,16 @@ type
|
||||
FOnItemChange: TCheckItemChange;
|
||||
FOnItemClick: TCheckListClicked;
|
||||
procedure CheckComboBoxFormCloseHandler(Sender: TObject; var CloseAction: TCloseAction);
|
||||
// procedure CloseUpHandler(Sender: TObject);
|
||||
function GetButtonWidth: Integer;
|
||||
function GetChecked(AIndex: Integer): Boolean;
|
||||
function GetItemEnabled(AIndex: Integer): Boolean;
|
||||
function GetItems: TStrings;
|
||||
function GetState(AIndex: Integer): TCheckBoxState;
|
||||
function IsButtonWidthStored: Boolean;
|
||||
procedure ItemClickHandler(Sender: TObject; AIndex: Integer);
|
||||
procedure ItemsToCheckListbox(ACheckListbox: TCheckListbox);
|
||||
procedure SetAllowGrayed(AValue: Boolean);
|
||||
procedure SetButtonWidth(AValue: Integer);
|
||||
procedure SetChecked(AIndex: Integer; const AValue: Boolean);
|
||||
procedure SetDelimiter(AValue: Char);
|
||||
procedure SetDropDownCount(AValue: Integer);
|
||||
@ -111,6 +113,7 @@ type
|
||||
published
|
||||
property AllowGrayed: Boolean read FAllowGrayed write SetAllowGrayed default false;
|
||||
property AutoDropDown: Boolean read FAutoDropDown write FAutoDropDown default false;
|
||||
property ButtonWidth: Integer read GetButtonWidth write SetButtonWidth stored IsButtonWidthStored;
|
||||
property Delimiter: char read FDelimiter write SetDelimiter default ';';
|
||||
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
|
||||
property EscCancels: Boolean read FEscCancels write FEscCancels default true;
|
||||
@ -632,6 +635,11 @@ begin
|
||||
Result := TCCBButton;
|
||||
end;
|
||||
|
||||
function TCheckComboBoxEx.GetButtonWidth: Integer;
|
||||
begin
|
||||
Result := Buddy.Width;
|
||||
end;
|
||||
|
||||
function TCheckComboBoxEx.GetChecked(AIndex: Integer): Boolean;
|
||||
begin
|
||||
Result := FItems.Checked[AIndex];
|
||||
@ -657,6 +665,11 @@ begin
|
||||
Result := FItems.State[AIndex];
|
||||
end;
|
||||
|
||||
function TCheckComboBoxEx.IsButtonWidthStored: Boolean;
|
||||
begin
|
||||
Result := Buddy.Width <> GetSystemMetrics(SM_CXVSCROLL);
|
||||
end;
|
||||
|
||||
procedure TCheckComboBoxEx.ItemClickHandler(Sender: TObject; AIndex: Integer);
|
||||
begin
|
||||
UpdateCaption;
|
||||
@ -735,6 +748,14 @@ begin
|
||||
UpdateCaption;
|
||||
end;
|
||||
|
||||
procedure TCheckComboBoxEx.SetButtonWidth(AValue: Integer);
|
||||
begin
|
||||
if AValue < 0 then
|
||||
AValue := GetSystemMetrics(SM_CXVSCROLL);
|
||||
if Buddy.Width <> AValue then
|
||||
Buddy.Width := AValue;
|
||||
end;
|
||||
|
||||
procedure TCheckComboBoxEx.SetChecked(AIndex: Integer; const AValue: Boolean);
|
||||
begin
|
||||
if FItems.Checked[AIndex] = AValue then
|
||||
|
Reference in New Issue
Block a user