LCL: TSpeedButton, TBitBtn: ImageIndex with combo box. Issue #33645

git-svn-id: trunk@57708 -
This commit is contained in:
ondrej 2018-04-25 10:56:32 +00:00
parent aba4fa2017
commit 1412bf4f4a
5 changed files with 17 additions and 12 deletions

View File

@ -672,7 +672,11 @@ begin
end
else
begin
Component := Component.GetParentComponent;
if not (
(Component is TCustomSpeedButton)
or (Component is TCustomBitBtn))
then
Component := Component.GetParentComponent;
if Component = nil then
Exit;
PropInfo := TypInfo.GetPropInfo(Component, 'Images');

View File

@ -169,8 +169,8 @@ type
function GetCaptionOfKind(AKind: TBitBtnKind): String;
function GetImages: TCustomImageList;
procedure SetImages(const aImages: TCustomImageList);
function GetImageIndex: Integer;
procedure SetImageIndex(const aImageIndex: Integer);
function GetImageIndex: TImageIndex;
procedure SetImageIndex(const aImageIndex: TImageIndex);
function GetImageWidth: Integer;
procedure SetImageWidth(const aImageWidth: Integer);
protected
@ -200,7 +200,7 @@ type
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
property Images: TCustomImageList read GetImages write SetImages;
property ImageIndex: Integer read GetImageIndex write SetImageIndex default 0;
property ImageIndex: TImageIndex read GetImageIndex write SetImageIndex default -1;
property ImageWidth: Integer read GetImageWidth write SetImageWidth default 0;
property Kind: TBitBtnKind read FKind write SetKind default bkCustom;
property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft;
@ -325,8 +325,8 @@ type
procedure WMLButtonDBLCLK(Var Message: TLMLButtonDblClk); message LM_LBUTTONDBLCLK;
function GetImages: TCustomImageList;
procedure SetImages(const aImages: TCustomImageList);
function GetImageIndex: Integer;
procedure SetImageIndex(const aImageIndex: Integer);
function GetImageIndex: TImageIndex;
procedure SetImageIndex(const aImageIndex: TImageIndex);
function GetImageWidth: Integer;
procedure SetImageWidth(const aImageWidth: Integer);
protected
@ -384,7 +384,7 @@ type
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0;
property Images: TCustomImageList read GetImages write SetImages;
property ImageIndex: Integer read GetImageIndex write SetImageIndex default 0;
property ImageIndex: TImageIndex read GetImageIndex write SetImageIndex default -1;
property ImageWidth: Integer read GetImageWidth write SetImageWidth default 0;
property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft;
property Margin: integer read FMargin write SetMargin default -1;

View File

@ -107,10 +107,10 @@ begin
Result := FButtonGlyph.ShowMode;
end;
function TCustomBitBtn.GetImageIndex: Integer;
function TCustomBitBtn.GetImageIndex: TImageIndex;
begin
if FButtonGlyph.ExternalImages=GLCLBtnGlyphs then
Result := 0
Result := -1
else
Result := FButtonGlyph.ExternalImageIndex;
end;
@ -162,7 +162,7 @@ begin
FButtonGlyph.ShowMode := AValue;
end;
procedure TCustomBitBtn.SetImageIndex(const aImageIndex: Integer);
procedure TCustomBitBtn.SetImageIndex(const aImageIndex: TImageIndex);
begin
FButtonGlyph.ExternalImageIndex := aImageIndex;
end;

View File

@ -67,6 +67,7 @@ begin
FOriginal := TGlyphBitmap.Create(Self);
FOriginal.OnChange := @GlyphChanged;
FNumGlyphs := Low(TNumGlyphs);
FExternalImageIndex := -1;
end;
{------------------------------------------------------------------------------

View File

@ -211,7 +211,7 @@ begin
end;
end;
procedure TCustomSpeedButton.SetImageIndex(const aImageIndex: Integer);
procedure TCustomSpeedButton.SetImageIndex(const aImageIndex: TImageIndex);
begin
FGlyph.ExternalImageIndex := aImageIndex;
end;
@ -1064,7 +1064,7 @@ begin
end;
end;
function TCustomSpeedButton.GetImageIndex: Integer;
function TCustomSpeedButton.GetImageIndex: TImageIndex;
begin
Result := FGlyph.ExternalImageIndex;
end;