Recent

Author Topic: TSpeedButton & TImageList  (Read 390 times)

rpetges

  • Jr. Member
  • **
  • Posts: 96
    • Attribute Changer Website
TSpeedButton & TImageList
« on: January 21, 2023, 09:58:39 am »
Hi all,

I use TSpeedbuttons in combination with glyphs ( see screenshot ) to modify the appearance of button icons for enabled and disabled state. For High DPI I loaded different icon resources based on the scaling in Windows OS.

Newer versions of Lazarus provide a more elegant way to do this with TImageList and the Scaled property. The TSpeedButton images  ( PNG format ) scale fine depending on the Windows scaling value, but how can I get back the feature that the image changes between an enabled/disabled state of the button ?

The only solution I found so far is to add the "enabled" and "disabled" glyph to the TImageList and then switch the TSpeedButton.ImageIndex property to select the corresponding image.

Best regards
« Last Edit: January 21, 2023, 10:56:10 am by rpetges »

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: TSpeedButton & TImageList
« Reply #1 on: January 21, 2023, 10:56:30 am »
In Laz/main, TSpeedButton and TBitBtn have are several imageindex properties
Code: Pascal  [Select][+][-]
  1. type
  2.   TSpeedButton = class(TCustomSpeedButton)
  3.   published
  4.     ...
  5.     property DisabledImageIndex;
  6.     property HotImageIndex;
  7.     property ImageIndex;
  8.     property PressedImageIndex;
  9.     property SelectedImageIndex;
  10.     ...
  11.   end;

rpetges

  • Jr. Member
  • **
  • Posts: 96
    • Attribute Changer Website
Re: TSpeedButton & TImageList
« Reply #2 on: January 21, 2023, 10:59:38 am »
Hi wp,

Cool, I was not aware of this .... many thanks.

 

TinyPortal © 2005-2018