Findcomponent in script

edited 12:18PM in FastScript
Hi,
I want to access some components of my form via the script. I want to use the findcomponent option, but it complains findcomponent is unknown. So I add my own myFindComponentfunction, but I fail to convert it in then callMethod function

function CallMethod(Instance: TObject; ClassType: TClass; const
MethodName: string; var Params: Variant): Variant;
if uppercase(MethodName) = uppercase('MyFindComponent') then
begin
if MyFindComponent(Params[0])<>nil then
result :=(MyFindComponent(Params[0]));
exit;
end;
end;
Delphi complains cannot convert variant to Tcomponent.
Is there another possibility ?

Comments

  • edited 12:18PM
    For who ever cares about it.
    You can cast it to Integer
    result :=integer(MyFindComponent(Params[0]));


    It work

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.