Assign event to memoview at runtime using VB6

keturpatelketurpatel India
edited 7:00PM in FastReport 4.0
I had posted same question in Fast-report studio forum, but did not got answer, so re-posting here.
[topic="9158"]Original post[/topic]


I'm trying to add event to memoview at runtime, but cannot find way to assign event.

I'm using VB6 and creating report at runtime with several memoviews.
I have added script to report object, which has some variables and procedures.

Now i want to assign one of script procedure to obp event of memoview in report.
but cant find way to do so. my fastreport version is 4.9

Here is sample vb6 code i am using :
    
       sTemp = "var xTotDay   :Double;" & _
                      vbCrLf & _
                      vbCrLf & _
            "procedure MemoView1OnBeforePrint(Sender: TfrxComponent);" & vbCrLf & _
            "begin" & vbCrLf & _
            "     xTotDay := 1234;
            "     MemoView1.Text := FormatFloat('0.00',xTotDay);" & vbCrLf & _
            "end;" & _
                       vbCrLf & _
                       vbCrLf & _
            "begin" & vbCrLf & _
            "       " & vbCrLf & _
            "end."

    MyTfrxReport.Script.ClearScript
    MyTfrxReport.ScriptLanguage = "PascalScript"
    MyTfrxReport.ScriptText = sTemp

Here in above code,
I want to assign Procedure MemoView1OnBeforePrint as event handler for MemoView1's OnBeforePrint
I need something like MyMemoview.EventHandler.OnBeforePrint = "MemoView1OnBeforePrint"


Please help me.
Thanks in advance.



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.