Dear Sirs,
Delphi 10.4.2 Sydney
Web Core 1.7.0.1 (full)
We get exception on runtime if we put TWebDBCheckbox control on form and run the project.
ERROR
Uncaught TypeError: Cannot read property 'FDataSet' of null | TypeError: Cannot read property 'FDataSet' of null at Object.IsEnabled (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:74753:113) at Object.UpdateElementData (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:31854:18) at Object.UpdateElementData (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:40482:57) at Object.UpdateElement (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:31718:14) at Object.EndUpdate (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:33229:43) at Object.EndUpdate (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:33714:31) at Object.AfterLoadDFMValues (http://localhost:8000/WebCoreBugs/WebCoreBugs.js:13039:12) at Object.LoadDFMValues
Somehow the problem is "Full/Complete Boolean Evaluation" when form is loading controls (AfterLoadDFMValues).
DataSource = nil
DataSet = nil
Enabled = true
function TDBCheckBox.IsEnabled: boolean;
begin
Result := Enabled and CheckDataSet and DataSource.AutoEdit or (DataSource.DataSet.State in [dsEdit,dsInsert]);
end;
By default the TWebDBCheckbox has no DataSource value at design time. But that triggers an exception when loading the form on runtime.
Partial Boolean Evaluation works most of the times for example:
var
B: Boolean;
begin
DataSource := nil;
B := True or (DataSource.DataSet.RecordCount>0);
end;
throws no exception.
Kind Regards