[lazarus] Problem

Cliff Baeseman Cliff.Baeseman at Greenheck.Com
Wed May 5 12:15:32 EDT 1999


I am going to wack all of the controls loaded on main tonight but I will
archive the file before I do this.

Trying to do a clean up to ready the main form for real work.......

Cliff

-----Original Message-----
From: Michael A. Hess [mailto:mhess at miraclec.com]
Sent: Wednesday, May 05, 1999 9:57 AM
To: lazarus at miraclec.com
Subject: Re: [lazarus] Problem


Shane Miller wrote:
>
> I am getting some errors when I don't think I should be and am asking for
ideas.  Herre's an example.
>
> In Editor.pp I have the following declaration:
>
> TEditor  = class(TForm)
>   public
>   Memo1 : TMemo
>   PageControl1 : TPageControl;
>  TabSheet1 : TTabSheet;
>  end;

<snip>

I don't know if this relates but I have noticed one problem. In main.pp
in TForm1 you define a public variable fmEditor. This is loaded with the
return value of the TEditor.Create call. Fine and dandy. However, in the
editor.pp code you also declare a global variable as fmEditor. I can't
see yet were this might cause the confusion you are getting. I see then
in the TEditor.Create you set the global fmEditor := Self;

In your current configuration you are then using the global fmEditor
internally in the TEditor class. This is a no-no. This means you can
only every have one instance of TEditor. If you try to create another
instance of TEditor it overrights the value in the global fmEditor. Now
if the first instance of TEditor tries to access one of it's methods the
fmEditor value it will attempt to use will be the one from the second
instance of TEditor. This would REALLY mess things up. You should be
using self in all of these locations. This in fact would only be
required in the Create(self) calls. Where you use it to access
properties of TEditor you don't need to add it at all since it will
assume to use the properties from the class where the method is located.

I have another question.

Why are you using {$I+ Strings.inc) in stdcontrols.pp? Why don't you
just add the strings unit to the uses clause?

At this point I think the problem you are seeing is indeed a compiler
error but I will look at the code some more.

Talk at you later,
--
==== Programming my first best destiny! ====

Michael A. Hess      Miracle Concepts, Inc.
mhess at miraclec.com   http://www.miraclec.com

_________________________________________________________________
     To unsubscribe: mail lazarus-request at miraclec.com with
                "unsubscribe" as the Subject






More information about the Lazarus mailing list