Recent

Author Topic: TCheckBox.AutoSize doesn't work when changing caption in Runtime  (Read 6693 times)

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Hi,

When I'm changing caption in Object Inspector then it work fine, but when I'm changing in runtime then it doesn't. CheckBox1.AdjustSize doesn't help. The only thing that comes to mind is CheckBox1.Width := Canvax.TextWidth(CheckBox1.Caption) but this give me only text size. How to get width of check button?

Regards and sorry for my english.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #1 on: August 10, 2010, 03:05:50 pm »
Which operating system, lazarus version, fpc version, etc? Did you try setting AutoSize to true?

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #2 on: August 10, 2010, 03:17:45 pm »
Did you try setting AutoSize to true?
Yes, I did.

Sorry: Ubuntu 10.4 64bit (but I remember, I had this same problem on windows too) Lazarus 0.9.29 compiled from SVN source yeasterday (revision 27042 ? ), FPC 2.5.1 compiled from SVN source (revision 100802 ? )

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #3 on: August 10, 2010, 03:38:12 pm »
Please create a new bug report and attach a test project

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #4 on: August 11, 2010, 10:07:38 am »
I fill a CheckListBox with data on runtime. Sometimes it happens that autosize doesn't work as you describe. But when I resize the formular it fits well. A workaround could be to call this method (or just to change size).
Lazarus 1.7 (SVN) FPC 3.0.0

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #5 on: August 11, 2010, 01:19:37 pm »
Sorry, very big mistake. CheckBox1.Autosize works well, but CheckBox1.Width return wrong number. I have not seen it before, because other components were dependent of CheckBox1.Width, so they just cover CheckBox1. Someone had this same problem, but it has not been resolved:
http://www.lazarus.freepascal.org/index.php/topic,4343.0.html
Anyone have idea how to "refresh" width of CheckBox?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #6 on: August 11, 2010, 02:37:25 pm »
Gtk2 or Qt? Is the issue already in the bug tracker?

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: TCheckBox.AutoSize doesn't work when changing caption in Runtime
« Reply #7 on: August 11, 2010, 04:21:34 pm »
GTK2. I will post this bug. Thanks.

 

TinyPortal © 2005-2018