Recent

Author Topic: [SOLVED] Exception Class error on Checkbox  (Read 2155 times)

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
[SOLVED] Exception Class error on Checkbox
« on: August 31, 2017, 01:29:28 am »
Under Delphi, creating a checkbox was easy.

I get an Exception Class error if I click in the checkbox ...

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  with CheckBox1 do
    begin
      Checked:=not Checked;
    end;
end;

Bazza
« Last Edit: September 09, 2017, 06:53:14 am by Bazzao »
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Exception Class error on Checkbox
« Reply #1 on: August 31, 2017, 02:03:29 am »
What do you try to achieve? Checkbox changes its state automatically when clicked, your code will cause unchangeble checkbox. Even more, changing state triggers OnClick event, therefore your code causes endless loop.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
Re: Exception Class error on Checkbox
« Reply #2 on: August 31, 2017, 08:43:41 am »
Well how improved is that!

In old Dephi (acquired last century), you had to check it yourself -- hence the code.

I should think more in the future than in the past and forget what I learned all those years ago.

Many thanks Blaazen.

Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Thaddy

  • Hero Member
  • *****
  • Posts: 14390
  • Sensorship about opinions does not belong here.
Re: Exception Class error on Checkbox
« Reply #3 on: August 31, 2017, 09:13:40 am »
Welllllll NO. Just tested D2 because I was curious....
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018