Come on folks, no quick answers to my last question? :-) Someone out there must know of…
Could it be the resizing causing the error?
Cliff

Mailing lists / lazarus / 1999-05
13 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Come on folks, no quick answers to my last question? :-) Someone out there must know of…
Could it be the resizing causing the error?
Cliff
No. It's not actually simply related to the left, top, width, height. It's really ANY propert I try to access. I get a sigsegv error immediatly upon accessing those properties.
Shane
>> Cliff Baeseman 05/04 3:30 PM >>>
Could it be the resizing causing the error?
Cliff
You are correct that if we create a fmEditor value as we were in TEditor and assign it to…
Ouch! Yeah I would have to say then that this is definitly a compiler issue.
I see that you guys don't set either {$mode delphi} or {$mode objfpc} in your code. Are you using -s2 or -sd in your compiler command line?
In my opinion it would be better to set this as a mode switch in the source so that a user doesn't have to modify their ppc386.cfg. That is just my opinion. :-)
Talk at you later,
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;In my code, I want to assign the memo width to the tabsheet's width so I do this:
Procedure TEditor.CreateMemo;
begin
Memo1 := TMemo.Crerate(TabSheet1);
Memo1.Left := TabSheet1.Left;
Memo1.Top := TabSheet1.Top;
Memo1.Width:= TabSheet1.WIdth;
Memo1.Height := Tabsheet1.Height;
end;This does NOT work if I create the tabsheet in a procedure other than the one above. If I create it in the one above where Memo1 uses it's sizes, then it works otherwise it throws an error.
So what I did was took the line
TabSheet1 := TTabSheet.Create(PageControl1)
out of where it WAS and put it in this procedure. Then it ran fine. It compiles either way, it just doesn't run.
I am currently running into a similiar problem. I create the TEditor and such. Then another class calls a TEditor function. I go into this function, display the caption of the form so I know that the TEditor 'self' is who I think it is, then I try to use Memo1.fcomponent and it crashes. It works fine if I declase Memo1 global to the unit but not if I have it in TEditor's class declaration.
Any thoughts? Seems odd. Can I blame this on the compiler? :-)
Shane
<snip> I don't know if this relates but I have noticed one problem. In main.pp in TForm1…
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
I am getting some errors when I don't think I should be and am asking for ideas. Herre's…
<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,
No. It's not actually simply related to the left, top, width, height. It's really ANY…
is it due to a nil pointer? did you update the cvs with the code you sent me?
Cliff
Come on folks, no quick answers to my last question? :-) Someone out there must know of some stupid mistake I am making to cause this error....please let me know
Shane
>> "Shane Miller" 05/04 1:01 PM >>>
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;In my code, I want to assign the memo width to the tabsheet's width so I do this:
Procedure TEditor.CreateMemo;
begin
Memo1 := TMemo.Crerate(TabSheet1);
Memo1.Left := TabSheet1.Left;
Memo1.Top := TabSheet1.Top;
Memo1.Width:= TabSheet1.WIdth;
Memo1.Height := Tabsheet1.Height;
end;This does NOT work if I create the tabsheet in a procedure other than the one above. If I create it in the one above where Memo1 uses it's sizes, then it works otherwise it throws an error.
So what I did was took the line
TabSheet1 := TTabSheet.Create(PageControl1)
out of where it WAS and put it in this procedure. Then it ran fine. It compiles either way, it just doesn't run.
I am currently running into a similiar problem. I create the TEditor and such. Then another class calls a TEditor function. I go into this function, display the caption of the form so I know that the TEditor 'self' is who I think it is, then I try to use Memo1.fcomponent and it crashes. It works fine if I declase Memo1 global to the unit but not if I have it in TEditor's class declaration.
Any thoughts? Seems odd. Can I blame this on the compiler? :-)
Shane
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
You are correct that if we create a fmEditor value as we were in TEditor and assign it to self, then everytime we create another one, fmeditor will lose it's prior value and be assigned something new. Here's the issue though, if you try to access CAPTION like Writeln(Caption) then you get a sigsegv or when you try to access ANY value through SELF.
Perhaps it is an issue with the compiler. I commented out all the fmeditor stuff and now none of it works when I try to use SELF. It simply crashes.....
Shane
>> "Michael A. Hess" 05/05 9:59 AM >>>
<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,
Did your wife have her baby? You must be busy I have not heard form you in a day or two...
Cliff
Ouch! Yeah I would have to say then that this is definitly a compiler issue. I see that…
I tried setting S2 and cannot even compile with that switch setting?
Cliff
No, she didn't have the baby. Due in August. I simply am trying to figure out the error…
Raining pretty hard in Wausau this afternoon...
Wish I could play golf last time I tried bout killed a dude behind me with the ball. I still havnt figured out how it went backwards he he he.
Cliff
No, she didn't have the baby. Due in August. I simply am trying to figure out the error I am getting when I try to access the Form's Caption through the SELF parameter. I'm having difficulty with it. Also, that new employee started so I have to spend some time with her.
If I don't play golf tonight, thewn I'll be banging away at the code. Shane
>> Cliff Baeseman 05/06 12:55 PM >>>
Did your wife have her baby? You must be busy I have not heard form you in a day or two...
Cliff