View Issue Details

IDProjectCategoryView StatusLast Update
0033076LazarusLCLpublic2019-10-13 07:48
ReporterBenjamin ClementsAssigned ToOndrej Pokorny 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionreopened 
PlatformWindowsOSWindows 10OS Version10.0.15063
Product Version1.8Product Build 
Target Version1.10Fixed in Version1.9 (SVN) 
Summary0033076: TCheckBox state change does not trigger OnChange event
DescriptionChanging the State of a TCheckBox does not trigger the OnChange event like changing Checked or manually clicking does
Steps To ReproduceSet an OnChange event handler on a checkbox and change the state, it will not run.
TagsNo tags attached.
Fixed in Revision57155
LazTarget1.10
WidgetsetWin32/Win64
Attached Files
  • CheckBox-State-OnChange.zip (2,468 bytes)
  • checkbox.diff (319 bytes)
    Index: lcl/include/customcheckbox.inc
    ===================================================================
    --- lcl/include/customcheckbox.inc	(revision 57151)
    +++ lcl/include/customcheckbox.inc	(working copy)
    @@ -29,6 +29,7 @@
       begin
         FState := Value;
         ApplyChanges;
    +    DoClickOnChange;
       end;
     end;
     
    checkbox.diff (319 bytes)

Relationships

parent of 0033088 closedOndrej Pokorny Patches Tool, Options crashes for IDE compiled for Carbon 
related to 0033573 closedOndrej Pokorny Lazarus DBChekbox enter dataset to edit mode 
related to 0035018 closedMichl Lazarus The builded EXE crashes before the formular is showing 
related to 0036170 new Lazarus When you have multiple toggle boxes and select different ones causes system to lock 

Activities

Benjamin Clements

2018-01-26 01:51

reporter  

CheckBox-State-OnChange.zip (2,468 bytes)

Benjamin Clements

2018-01-26 01:54

reporter   ~0106046

Also applicable to 1.6.4

Vojtech Cihak

2018-01-26 02:28

reporter   ~0106047

It does not work on Linux too.

Note: CheckBoxes in Delphi7 don't have OnChange event.

Serge Anvarov

2018-01-26 17:00

reporter   ~0106053

Patch added

Serge Anvarov

2018-01-26 17:01

reporter  

checkbox.diff (319 bytes)
Index: lcl/include/customcheckbox.inc
===================================================================
--- lcl/include/customcheckbox.inc	(revision 57151)
+++ lcl/include/customcheckbox.inc	(working copy)
@@ -29,6 +29,7 @@
   begin
     FState := Value;
     ApplyChanges;
+    DoClickOnChange;
   end;
 end;
 
checkbox.diff (319 bytes)

Vojtech Cihak

2018-01-26 18:36

reporter   ~0106054

Patch works on Linux+Qt, trunk.
I'm curious what broked it. I don't see related changes in customcheckbox.inc.

Juha Manninen

2018-01-27 09:53

developer   ~0106063

Maybe it never worked.

Ondrej Pokorny

2018-01-27 13:58

developer   ~0106066

I didn't apply the patch but used the same approach that also SetChecked uses (I am sure it's there for some reason.)

Vojtech Cihak

2018-01-27 13:59

reporter   ~0106067

Last edited: 2018-01-27 14:00

View 2 revisions

@ Maybe it never worked.

I'm almost sure it did. I implemented TECSwitch and TCheckBoxThemed events to mimic native TCheckBox and they both gives OnChange event when State property changes.

Ondrej Pokorny

2018-01-27 14:04

developer   ~0106068

> I'm almost sure it did.

I just tested Lazarus 1.4.2 and it did not.

Vojtech Cihak

2018-01-27 14:35

reporter   ~0106071

I tested in 0.9.26, it does not work there. Juha is right, it never worked.

Bart Broersma

2018-01-27 14:38

developer   ~0106072

> I tested in 0.9.26
I was so much younger then ...

jamie philbrook

2018-01-28 02:47

reporter   ~0106078

If you want to be wonderful a added solution would be to also
add a "OnCheckChanged" event with a flag to indicate in which manner
it got changed.

   1: Mouse;
   2: Keyboard;
   3: Software;

  In many cases, if software is the reason, you may want to assume it could
be setup (initiation) doing it. Also make sure to prevent reentry incase someone
wants to change the state of it while in there.

jamie philbrook

2018-01-28 03:03

reporter   ~0106079

I hate to burst you guys bubble but it works for me here.

1.8.0 64bit Windows 10.
 
 Also please check the documentation.

http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html

 The CHECKED property..

   It claims it does not work, does nothing.

   it does work..

   Also, It claims the OnChange is for any change in properties..
not jus the check state toggle.

 w

Juha Manninen

2019-10-13 07:48

developer   ~0118542

This caused a regression (see related issue) and must be reopened.

Issue History

Date Modified Username Field Change
2018-01-26 01:51 Benjamin Clements New Issue
2018-01-26 01:51 Benjamin Clements File Added: CheckBox-State-OnChange.zip
2018-01-26 01:54 Benjamin Clements Note Added: 0106046
2018-01-26 02:28 Vojtech Cihak Note Added: 0106047
2018-01-26 17:00 Serge Anvarov Note Added: 0106053
2018-01-26 17:01 Serge Anvarov File Added: checkbox.diff
2018-01-26 18:36 Vojtech Cihak Note Added: 0106054
2018-01-27 07:04 Ondrej Pokorny Assigned To => Ondrej Pokorny
2018-01-27 07:04 Ondrej Pokorny Status new => assigned
2018-01-27 09:53 Juha Manninen Note Added: 0106063
2018-01-27 13:58 Ondrej Pokorny Fixed in Revision => 57155
2018-01-27 13:58 Ondrej Pokorny LazTarget => -
2018-01-27 13:58 Ondrej Pokorny Note Added: 0106066
2018-01-27 13:58 Ondrej Pokorny Status assigned => resolved
2018-01-27 13:58 Ondrej Pokorny Resolution open => fixed
2018-01-27 13:59 Vojtech Cihak Note Added: 0106067
2018-01-27 14:00 Vojtech Cihak Note Edited: 0106067 View Revisions
2018-01-27 14:04 Ondrej Pokorny Note Added: 0106068
2018-01-27 14:05 Ondrej Pokorny LazTarget - => 1.8
2018-01-27 14:05 Ondrej Pokorny Target Version => 1.8.2
2018-01-27 14:35 Vojtech Cihak Note Added: 0106071
2018-01-27 14:38 Bart Broersma Note Added: 0106072
2018-01-27 19:41 Ondrej Pokorny Relationship added parent of 0033088
2018-01-28 02:47 jamie philbrook Note Added: 0106078
2018-01-28 03:03 jamie philbrook Note Added: 0106079
2018-04-06 19:30 Ondrej Pokorny Relationship added related to 0033573
2018-04-06 20:39 Ondrej Pokorny LazTarget 1.8 => 1.10
2018-04-06 20:39 Ondrej Pokorny Fixed in Version => 1.9 (SVN)
2018-04-06 20:39 Ondrej Pokorny Target Version 1.8.2 => 1.10
2019-02-05 22:03 Michl Relationship added related to 0035018
2019-10-13 07:44 Juha Manninen Relationship added related to 0036170
2019-10-13 07:48 Juha Manninen Status resolved => assigned
2019-10-13 07:48 Juha Manninen Resolution fixed => reopened
2019-10-13 07:48 Juha Manninen Note Added: 0118542