[lazarus] HELP PLEASE!

Shane Miller SMiller1 at stvgb.org
Mon May 17 16:47:44 EDT 1999



>>In Editor.pp IO have a TEditor class that contains a TMemo (Memo1).  If I create te Memo (Memo1 := TMemo1.Create(fmeditor)) I can access the Memo1 reference ONLY in the procedure that it was created in, not anywhere else!  

>>This sounds very strange. Are you sure you haven't a same named local
variable or something alike... sometimes, the more obvious the bug is,
the most difficult to realize.


I agree it sounds odd but take a look at the source out of CVS.  It's happening and there are no other local or global variables with the same name.



>>If I create the Memo1 in the TEditor.Create function then I get an error when I try to do a Memo1.Show in the openfile procedure or anywhere else I try to access it....

>>Hmmm... try to store an integer value, typecasting the pointer:

  memo1 := TMemo( 666 ); 

...or whatever the trick the compiler needs to eat this. Then try to
peek this value doing the reverse typecast from some other point and
show it with a writeln. If the value has changed you may be trashing
the memory elsewhere!



I will take a look at that and see if it gives me the 666 (or whatever) back.

Shane







More information about the Lazarus mailing list