User Function not working after showing Designer
Hi there,
I find that the user defined function I create no longer works after showing Report Designer
Here is what I did :
1. Add my function:
begin
frxReport1.AddFunction( 'Procedure MyFunction' );
frxReport1.OnUserFunction := MyFunction;
end;
function TForm2.MyFunction(const MethodName: string; var Params: Variant): Variant;
begin
showmessage('Hello World');
end;
2. Put the function on Report Memo DoubleClick event Script:
procedure Memo1OnPreviewDblClick(...)
begin
MyFunction;
end;
3. Compile and run the program (when I double click the memo here, it works)
4. Show the designer:
frxReport1.DesignReport
5. Close the Designer
6. When I double click the Memo, the user function does not work
If I run "frxReport1.ShowReport;" after returning from Designer, it works.. but I don't want that since the Report takes sometime to load
Can Anyone help me, did I do something wrong
Thanks
I find that the user defined function I create no longer works after showing Report Designer
Here is what I did :
1. Add my function:
begin
frxReport1.AddFunction( 'Procedure MyFunction' );
frxReport1.OnUserFunction := MyFunction;
end;
function TForm2.MyFunction(const MethodName: string; var Params: Variant): Variant;
begin
showmessage('Hello World');
end;
2. Put the function on Report Memo DoubleClick event Script:
procedure Memo1OnPreviewDblClick(...)
begin
MyFunction;
end;
3. Compile and run the program (when I double click the memo here, it works)
4. Show the designer:
frxReport1.DesignReport
5. Close the Designer
6. When I double click the Memo, the user function does not work
If I run "frxReport1.ShowReport;" after returning from Designer, it works.. but I don't want that since the Report takes sometime to load
Can Anyone help me, did I do something wrong
Thanks
Comments
Thanks Madas
I see you add a MethodName check and a Result value
I tried your suggestion but I'm afraid it is still not working.
Do you have any other Idea ?
is this a fast report bug ?
once more. try this. [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> i think the user function must be real function and not a procedure. if the user fucntion is a procedure you cant drag this "function" on to the report within the designer. greetings.[/img]
I'm using a TfrxPreview to Show the report.
it is on the TfrxPreview that the UserFunction does not work after showing Designer.
Sorry I didn't mention this, I didn't know that a report can be shown without a preview [img]style_emoticons/<#EMO_DIR#>/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> PS : the UserFunction will work if after I close the designer, I call "frxReport1.ShowReport();" The question is that I would like to skip "frxReport1.ShowReport();" because re-loading the report take sometime.[/img]