[Lazarus] Ok I give up!

Reinier Olislagers reinierolislagers at gmail.com
Sat Mar 2 18:15:36 CET 2013


Hi Paul,

I'm going to respond to the list as well so they know what's going on.

On 2-3-2013 17:35, Paul wrote:
> Thank you  Reinier for your offer to look at my code.I am new to Lazarus
> and am working through some delphi books to try and learn, but this has
> got me stumped.
> I tried a new form with Memo1 and used your code and it worked and the
> file was written to.
<snip form definition Paul included>

Normally it would be easier to send/upload both the .lfm and the .pas
file for the form - or better the entire project (easy via
project/publish project, then zip up the result - then you only include
relevant source files)

Also, saying what Lazarus version you're using normally helps...

That said, look at e.g.:
procedure TmpCut;
begin
  MemoCallNote.Lines.SaveToFile(MyTempFile);
  MemoCallNote.Clear;
end;

This is a regular procedure, not part of your form (the TFormCall object).
Without further changes, this code knows nothing about TFormCall,
including its MemoCallNote object. That's where the invalid qualifier
problems come from.

The easiest way to fix this is to move TmpCut to the private part of the
form:
interface
...
type

  { TFormCall }
  TFormCall = class(TForm)
...
  private
    { private declarations }
    procedure TmpCut;
...
this declares a procedure TmpCut as part of the form... and it has
access to form properties etc.

However, you'll need to modify the procedure body from
procedure TmpCut;
to
procedure TFormCall.TmpCut;
to match the declaration above.

Note: all of this typed by hand, hope I did it ok.

Hope this is clear & it works for you.





More information about the Lazarus mailing list