diff --git a/lcl/buttons.pp b/lcl/buttons.pp index f2ba340df1..05594cbbeb 100644 --- a/lcl/buttons.pp +++ b/lcl/buttons.pp @@ -101,6 +101,7 @@ type procedure CacheSetImageList(AImageList: TCustomImageList); procedure CacheSetImageIndex(AIndex, AImageIndex: Integer); protected + function CanShow: Boolean; procedure DoChange; virtual; procedure GlyphChanged(Sender: TObject); procedure SetTransparentMode(AValue: TGlyphTransparencyMode); diff --git a/lcl/include/buttonglyph.inc b/lcl/include/buttonglyph.inc index 3438853de2..6fa16aa90e 100644 --- a/lcl/include/buttonglyph.inc +++ b/lcl/include/buttonglyph.inc @@ -105,7 +105,7 @@ const (gdeNormal, gdeDisabled, gdeShadowed, gdeNormal, gdeHighlighted)); begin AUseAutoEffects := ThemeServices.GetOption(toUseGlyphEffects); - if Assigned(FExternalImages) then + if Assigned(FExternalImages) and CanShow then begin AImages := FExternalImages; AIndex := FExternalImageIndex; @@ -222,30 +222,6 @@ begin end; procedure TButtonGlyph.GlyphChanged(Sender: TObject); - - function CanShow: Boolean; - begin - Result := True; - if IsDesigning then - Exit; - case ShowMode of - gsmAlways: - Result := True; - gsmNever: - Result := False; - gsmApplication: - begin - case Application.ShowButtonGlyphs of - sbgAlways: Result := True; - sbgNever: Result := False; - sbgSystem: Result := SystemShowButtonGlyphs; - end; - end; - gsmSystem: - Result := SystemShowButtonGlyphs; - end; - end; - begin if FImagesCache <> nil then begin @@ -381,6 +357,29 @@ begin FImages := AImageList; end; +function TButtonGlyph.CanShow: Boolean; +begin + Result := True; + if IsDesigning then + Exit; + case ShowMode of + gsmAlways: + Result := True; + gsmNever: + Result := False; + gsmApplication: + begin + case Application.ShowButtonGlyphs of + sbgAlways: Result := True; + sbgNever: Result := False; + sbgSystem: Result := SystemShowButtonGlyphs; + end; + end; + gsmSystem: + Result := SystemShowButtonGlyphs; + end; +end; + procedure TButtonGlyph.CacheSetImageIndex(AIndex, AImageIndex: Integer); begin if (AIndex >= ord(Low(TButtonState))) and (AIndex <= Ord(High(TButtonState))) then