TBitBtn failed on me lazarus / 39-Graphics ---------------------------------------------------------------------- ArminLinder · 2017-02-14 21:23 Guys, tonight the IT devil is running free. Whatever I touch, miraculously fails. Even very basic things. And I cannot figure out why. Problem (already isolated from project): I have an application with a form, and a TBitBtn on it, width=45, height=45. I have a png, width = 180 (45x4), height = 45, 32 Bit colour depth (also tried with 24, no difference), with 4 different glyphs on it (for testing, I made 4 squares, 45x45 pixels each, in different colors). I habe assigned the png to the "Glyph" property, and set NumGlyphs to 4. Everything else on the defaults, so BitBtn is enabled= true. The preview of the image in the glyph's load dialog looks fine. When I run this project, always and only the first of the four glyphs is displayed, if I hover over or click onto the button. The button works OK, goes down and up on click. If the button is disabled, also no glyph is displayed as well, but some blueish placeholer. I did also try to convert the png to jpg and bmp, same problem: I can load the glyph image, preview is fine, but if I run the project I do always get the first image on the button. BUT:  the project exe runs fine on Windows 10, while it fails on Windows 7 (no re-compile!). And I am (almost) sure I had this thing running well on Windows 7 this morning. (Gnarl) Anyone having an idea, why this can happen? Armin. ---------------------------------------------------------------------- ArminLinder · 2017-02-14 21:40 This is the project source. Could not attach it to the previous post for no obvious reason - the Devil never sleeps, you know ... ---------------------------------------------------------------------- Bart · 2017-02-14 21:57 Quote from: Nimral on February 14, 2017, 10:23:38 pmI have assigned the png to the "Glyph" property, and set NumGlyphs to 4. Quote from http://docwiki.embarcadero.com/RADStudio/Berlin/en/Bitmap_Buttons: "Bitmap buttons can have 3 states: up, down, and held down. Set the NumGlyphs property to 3 to show a different bitmap for each state." Not sure if this applies to Lazarus as well, too lazy to look it up. Bart ---------------------------------------------------------------------- ArminLinder · 2017-02-15 06:34 That's what documenations are for: the devil  uses them to seed confusion. From the same doc: http://docwiki.embarcadero.com/Libraries/Berlin/en/Vcl.Buttons.TBitBtn .Glyph There it says: four pictures. Nevertheless I gave it a try, I cropped my bitmap to 3x45 and set NumGlyphs to 3 --> no change, on W7 still only Glyph #1 is displayed. And there is a Lazarus doc which says up to 5(!) images are supported, in addidion to Delphi's 4 a "Hot" (also called Hover or MouseOver) Icon was added, so I tried with a 5 icon bitmap and NumIcons=5 as well ... no progress. Thanks though, Armin. ---------------------------------------------------------------------- ArminLinder · 2017-02-15 08:40 After further testing, I came to the conclusion that this is a bug in Lazarus. Seems to affect Windows XP and WIndows 7,but not Windows 10. On Delphi XE7, the glyph works correctly. I'll file a bug now. (Bug filed: http://bugs.freepascal.org/view.php?id=31392) Armin. ---------------------------------------------------------------------- ArminLinder · 2017-02-15 20:10 Solved! With the help of Bart Broersma, I made progress: the malfunction arises only, when Windows Themes are turned off. It doesn't have anything to do with the OS version. I was unaware of this effect, since in Delphi RAD Studio the BitBtn works regardless of whether Windows Themes are turned on or off. Armin.