delphi - May DWS calling functions from sample unit? -
may dws calling functions sample unit? example:
fexecution.info.func['test.clickproc'].call(aparams); (this not working)
fexecution - idwsprogramexecution;
function declared in script code:
unit test; uses utestunit; procedure testfunc(lparam: string); begin showmessage(lparam); end; procedure clickproc(sender: tobject); begin showmessage('dws'); end; var s: tstringlist; var btn: tbutton; begin btn := tbutton.create(mainform); btn.onclick := clickproc; btn.parent(mainform); end.
clickproc in example.
i don't think can done.
the symbol lookup in call info.func[]
doesn't resolve name unit scope , identifier instead simple lookup symbol named "test.clickproc". since clickproc
procedure symbol named "clickproc" lookup doesn't find it.
i thought maybe possible find procedure symbol manually via symbol tables...
var fexecution: idwsprogramexecution; unitsymbol: tunitmainsymbol; funcsymbol: tfuncsymbol; info: iinfo; begin ... unitsymbol := fexecution.prog.unitmains.find('test'); funcsymbol := unitsymbol.table.findsymbol('clickproc', cvpublic) tfuncsymbol; // returns nil :-( info := fexecution.info.funcbysym[funcsymbol]; info.call; ...
... after consulting "documentation" (read: studying source, stepping through debugger , trial , error) i've come conclusion cannot done reliably @ time. is possible find "clickproc" symbol in 1 of many symbol tables i've not been able find reliable way qualify symbol unit name/symbol.
Comments
Post a Comment