I suddenly noticed a TDataModuleTestExchange(nil)
'constructor call' in our codebase:
procedure TDialoogConfigExchange.ButtonTestClick(Sender: TObject);
var
lDataModuleTestExchange: TDataModuleTestExchange;
lResult : Boolean;
begin
inherited;
[snip]
begin
lDataModuleTestExchange := TDataModuleTestExchange(nil); // *** HERE ***
try
lResult := lDataModuleTestExchange.GetCalendarFolder(EditHost.Text,EditGebruiker.Text,EditWachtwoord.Text);
if lResult then
ToonMelding(sExchangeTestGelukt, mtInformation, [mbOk])
else
ToonMelding(Meldingen.Text, mtError, [mbOK]);
finally
lDataModuleTestExchange.Free;
end;
end;
end;
So instead of TDataModuleTestExchange.**Create**(nil)
this works just fine!
unit dmTestExchange;
interface
uses
System.SysUtils, System.Classes,
Xml.XMLDoc, Xml.XMLIntf, Xml.XMLDOM,
TimeTellDM;
type
TDataModuleTestExchange = class(TTimeTellDataModule) // TDataModule descendant
private
public
function GetCalendarFolder(const AExchangeServerURL,AExchangeLoginName,AExchangePass: String): Boolean;
end;
No compiler error, no run-time issues. How come?
TButton(nil).Dragging
is also safe ;) – TalkativeTButton(nil).Dragging
isTrue
! – Johnnie