Recent

Author Topic: TBitBtn failed on me  (Read 4581 times)

ArminLinder

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
TBitBtn failed on me
« on: February 14, 2017, 10:23:38 pm »
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.


« Last Edit: February 14, 2017, 10:44:36 pm by Nimral »
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

ArminLinder

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
Re: TBitBtn failed on me
« Reply #1 on: February 14, 2017, 10:40:19 pm »
This is the project source. Could not attach it to the previous post for no obvious reason - the Devil never sleeps, you know ...
« Last Edit: February 14, 2017, 10:45:33 pm by Nimral »
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: TBitBtn failed on me
« Reply #2 on: February 14, 2017, 10:57:08 pm »
I 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

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
Re: TBitBtn failed on me
« Reply #3 on: February 15, 2017, 07:34:02 am »
That's what documenations are for: the devil  >:D 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.
« Last Edit: February 15, 2017, 12:24:38 pm by Nimral »
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

ArminLinder

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
Re: TBitBtn failed on me
« Reply #4 on: February 15, 2017, 09:40:39 am »
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.
« Last Edit: February 15, 2017, 12:15:24 pm by Nimral »
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

ArminLinder

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
Re: TBitBtn failed on me
« Reply #5 on: February 15, 2017, 09:10:25 pm »
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.
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

 

TinyPortal © 2005-2018