DesktopDateControl and DesktopTimeControl AddHandler not firing

The Einhugur DesktopDateControl and DesktopTimeControl controls don’t fire a Method when added via AddHandler.

If I add a DesktopDateControl and a DesktopTimeControl to a Window then run the AddHandler code in the Window’s Open Event ie

AddHandler DateControl1.ValueChanged, AddressOf DateControl1ValueChanged
AddHandler TimeControl1.ValueChanged, AddressOf TimeControl1ValueChanged

Then the Methods (DateControl1ValueChanged and TimeControl1ValueChanged) should fire when the date or time is changed. Unfortunately it does not.

Is this an issue with my code or with @Björn_Eiríksson? I have made a sample:

DateTimePicker AddHandler not firing.xojo_binary_project.zip (6.9 KB)

You need to call ReloadEvents on them.

Its because they cache the event handlers. Is better for speed but calls for extra step if you manually wire things with AddHandler.

Is this correct?:

AddHandler DateControl1.ValueChanged, AddressOf DateControl1ValueChanged
AddHandler TimeControl1.ValueChanged, AddressOf TimeControl1ValueChanged

DateControl1.ReloadEvents
TimeControl1.ReloadEvents

Yes

1 Like