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 end
else else
begin begin
Component := Component.GetParentComponent; if not (
(Component is TCustomSpeedButton)
or (Component is TCustomBitBtn))
then
Component := Component.GetParentComponent;
if Component = nil then if Component = nil then
Exit; Exit;
PropInfo := TypInfo.GetPropInfo(Component, 'Images'); PropInfo := TypInfo.GetPropInfo(Component, 'Images');

View File

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

View File

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

View File

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

View File

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