Icon from Lazarus icons resource lazarus / 39-Graphics ---------------------------------------------------------------------- Dibo · 2009-04-11 18:37 Hi, Lazarus have very nice collection of icons (I guess "Tango icons"?). Some icons are included in project exe file (like bitbuttons glyps). Can I somehow use this icons at runtime? I can't find any resource using resource explorer (PE Explorer, Reshack). Example, I want use some icons from bitbutton in my graphic control or speedbutton. I found LoadFromLazarusResource function in TBitmap but I don't know ResName values of this icons. I just don't want clutter resources by adding this same icons. Regards ---------------------------------------------------------------------- Paul Ishenin · 2009-04-12 05:09 Look for names at lcl\btn_icons.lrs, lcl\dialog_icons.lrs. Icon sources are places in lcl\images ---------------------------------------------------------------------- Dibo · 2009-04-12 12:45 Thanks for reply! I have some technical dillema. This is the code: Code: [Select]SpeedButton1.Glyph := LoadBitmapFromLazarusResource(BitBtnResNames[bkOK]);Must I free SpeedButton1.Glyph before LoadBitmapFromLazarusResource? Because this function create new bitmap instance (Result := TBitmap.Create), but when I do this: Code: [Select]SpeedButton1.Glyph.Free; SpeedButton1.Glyph := LoadBitmapFromLazarusResource(BitBtnResNames[bkOK]);  ... I have access violation. What about memory leaks? ---------------------------------------------------------------------- Paul Ishenin · 2009-04-12 14:15 SpeedButton.Glyph is a property. This property has setter method. In that setter method Assign() call is used to replace old bitmap content with new. Thus you cannot destroy SpeedButton.Glyph. You need to use temporary variable: Code: [Select]B := LoadBitmapFromLazarusResource(BitBtnResNames[bkOK]); SpeedButton1.Glyph := B; B.Free; Or better use next call: Code: [Select]SpeedButton11.LoadGlyphFromLazarusResource(BitBtnResName s[bkOK]);