Recent

Author Topic: [Solved] Bug in TBCButton? Caption's position doesn't change.  (Read 382 times)

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Not sure if this is a bug or a feature set that way.
I've got this bcp button (from the BGRA Button controls palette).
Here are the relevant properties:
Code: Pascal  [Select][+][-]
  1.     object BCButton1: TBCButton
  2.       Left = 36
  3.       Height = 68
  4.       Top = 12
  5.       Width = 116
  6.       //State properties omitted
  7.       Caption = 'Font'
  8.       Color = clNone
  9.       DropDownWidth = 16
  10.       DropDownArrowSize = 8
  11.       GlobalOpacity = 255
  12.       Glyph.Data = {Glyph data goes here}
  13.       GlyphAlignment = bcaCenterTop //<== this is where I think I'm having a problem
  14.       PreserveGlyphOnAssign = False
  15.       GlyphMargin = 0
  16.      //Round properties omitted
  17.     end
  18.   end
  19.  

I thought that by setting GlyphAlignment to bcaCenterTop, I would get the caption to lineup under the glyph (see the first attached image. The caption there is New, not Font, but it illustrates what I'm trying to achieve). Instead, changing the value of GlyphAlignment has no effect. Is this a bug, or do I misunderstand the purpose of this property? How could I get the caption to line up tightly under the glyph?


 
« Last Edit: April 27, 2023, 07:31:50 am by EganSolo »

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Re: [Solved] Bug in TBCButton? Caption's position doesn't change.
« Reply #1 on: April 27, 2023, 07:37:22 am »
Good news! It's not a bug.
I finally figured out what was going on by comparing my code to one of the sample programs: bgracontrols-master\test\testbcbbuttonfocus.lpi
That example uses BCBButtonFocus not BCBButton but the displays the same alignment behavior. In that example setting one of the buttons' alignment to GlyphCenterTop worked. I copied the button and pasted it into my program and, predictably, it continued to work. Going down the list of properties side-by-side for this button and the button I had created earlier, I found out the culprit: the property GlyphOldPlacement was set to true in my button and false in the one I had just copied. I'm not certain what this property does but it seems to prevent GlyphAlignment from working. Setting it to false resolved the problem.

Now, I'm going to look for docs on these buttons so I can stop shooting in the dark  :D

 

TinyPortal © 2005-2018