Recent

Author Topic: TArrow component supplement  (Read 4773 times)

wp

  • Hero Member
  • *****
  • Posts: 12793
Re: TArrow component supplement
« Reply #15 on: September 04, 2020, 04:12:27 pm »
This has nothing to do with manual image creation, but is a feature of TSpeedbutton. As I explained above TSpeedbutton can contain up to 4 images in the Glyph property, each one reserved for a specific state. These 4 images are arranged in a stripe, side by side. When an image is loaded into the Glyph property the component checks whether the image width is an integer multiple of the image height. If this is the case then TSpeedbutton assumes that the image is such a multi-image stripe and displays only first image of the stripe; of course, this image has Width=Height. The NumGlyphs property is automatically set to the result of this division. You can check this when you add
Code: Pascal  [Select][+][-]
  1.   Caption := IntToStr(SpeedButton1.NumGlyphs);
to the "MakeGlyph" procedure of your demo (after "Speedbutton1.Glyph := BM").

You can avoid this automatism if you force
Code: Pascal  [Select][+][-]
  1.   SpeedButton1.NumGlyphs := 1;  
immediately after "SpeedButton1.Glyph := BM".

There is a bug in TSpeedbutton by the way because this calculation obviously is not performed at designtime when a "double image" is assigned to Glyph. This is in contrast to Delphi as I just checked.

wittbo

  • Full Member
  • ***
  • Posts: 151
Re: TArrow component supplement
« Reply #16 on: September 04, 2020, 06:24:12 pm »
Whow!
Of course, this is logical. That means, this behaviour could also be seen with width = 90 and height = 60 or 30 for example.
A SpeedButton is really a special component; you have to be very aware of its features. Especially the use of multiple glyphs is a bit unusual.
-wittbo-
MBAir M2 with MacOS 14.4.1 / Lazarus  3.2.2
MacStudio M1 Max with MacOS 14.4.1 / Lazarus 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 12793
Re: TArrow component supplement
« Reply #17 on: September 04, 2020, 06:40:00 pm »
this behaviour could also be seen with width = 90 and height = 60 or 30 for example.
Almost, but not with W=90 and H=60 because they are no integer multiples.

Beginning with W=90 the first case is the double image: H = 45 (= 90/2), then the triple image: H = 30 (=90/3), and finally the quadruple image H = 22.5 (=90/4) -- well, the latter case does not happen because 22.5 is not an integer.
« Last Edit: January 02, 2021, 05:31:22 pm by wp »

 

TinyPortal © 2005-2018