Accsess Violation while assigning a value to MemoView

edited 5:34AM in FastReport 4.0
Hi, I'm going mad!

I want to change the text of memo view in fastScript.
So in onPreviewDoubleClick I wrote:

totalIDXMemo.Text:='Hello';

But all I get is an Access Violation. WHY??

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 5:34AM
    What is your 'onPreview'? is it a button on your form?
  • edited 5:34AM
    What is your 'onPreview'? is it a button on your form?

    This is my memo on report.

    I have deleted this event and try to assign a text somewhere else:

    myMemo.text:='Hello';

    I don't get access violation anymore, but the text doesn't change :/
  • edited 5:34AM
    Try to use this code in OnPreviewDblClick:
      TfrxMemoView(Sender).Memo.Text := 'Hello';
      Modified := true;
    
  • edited April 2010
    OlegK wrote: »
    Try to use this code in OnPreviewDblClick:
      TfrxMemoView(Sender).Memo.Text := 'Hello';
      Modified := true;
    


    OK, that works but what I really need to to is to change the text in other event handler. So SENDER is not taken under consideration, what's more "MODIFIED" is said to be undeclared identifier.

    What is strange is that:
    myMemo.Text:='Hello';
    showMessage(myMemo.Text);
    

    ShowMessage shows "Hello" while myMemo stays blank :|
  • edited 5:34AM
    wrote:
    OK, that works but what I really need to to is to change the text in other event handler.
    What event handler you want to use?
  • edited April 2010
    OlegK wrote: »
    OlegK wrote: »
    OK, that works but what I really need to to is to change the text in other event handler.
    What event handler you want to use?

    OnAfterPrint of other MemoView(lets call it "loadsMemo").

    This sumMemo holds result of an aggregate function, so this is the only place where I can get this result into variable.
    Then I make some other calculations and want to assign the result to myMemo:

    ForExample:
    var
      loads: integer;
    
    procedure loadsMemoOnAfterPrint(Sender: TfrxComponent);
    begin    
      loads:=StrToInt(loadsMemo.Text);
                                                                    
      if loads = 0 then totalIDXMemo.Text:='0'
      else                         
           totalIDXMemo.Text:=FloatToStr(loads*100);
    end;
    
  • edited 5:34AM
    wrote:
    This sumMemo holds result of an aggregate function, so this is the only place where I can get this result into variable.
    Add variable to report:
    var
      s: integer;
    
    and in OnBeforePrint event handler of totalIDXMemo write you agregate function:
    procedure totalIDXMemoOnBeforePrint(Sender: TfrxComponent);
    begin
      s := SUM(<ADOQuery1."CustNo">,MasterData1);    
    end;
    
    In memo totalIDXMemo write this:
    [s]
    
  • edited 5:34AM
    It doesn't work. "Cannot convert null value into integer"

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.