Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

For the past two weeks I've been trying to find a way to apply native icons to my TBitmapButtons.

I have been scouring the source code for all of Lazarus' components and have found some relevant functions. However, I don't know how to call these functions.

Delphi
function GetLCLDefaultBtnGlyph(Kind: TBitBtnKind): TGraphic;
begin
Result := GetDefaultButtonIcon(BitBtnImages[Kind]);
end;


I believe the above function controls the TBitmapButton property "kind" which includes some of the icons that I am talking about. However it does not include other essential button icons such as "Save", "Copy", etc. Thus, the following function has caught my attention a little more:

Delphi
function GetDefaultButtonIcon(idButton: Integer): TCustomBitmap;
begin
Result := nil;
if (idButton < Low(BitBtnResNames)) or (idButton > High(BitBtnResNames)) then
Exit;
if BitBtnResNames[idButton] = '' then
Exit;
Result := TPortableNetworkGraphic.Create;
Result.LoadFromResourceName(hInstance, BitBtnResNames[idButton]);
end;


Does anybody know how I can assign default system button icons to, for example, a "Save As" button using this function?

Thanks a lot for your help! :)

What I have tried:

I have tried learning about functions, however I don't know how to apply what I have learned in this context.
I have also tried other forums, however, nobody has replied with any Pascal-related solutions; only solutions in other languages such as Java.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900