Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-08

More on the Self and buttons behavior

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Vreman
to Curtis White: That might be why my compileroptions dialog button started crashing. In the OnClicked…
Show quoted text 7 lines
That might be why my compileroptions dialog button started crashing. In the OnClicked event, I just had Hide, which really means Self.Hide. So if Self refers to the button instead of the form, then it would be telling the button to hide. I don't quite know why this caused Lazarus to crash, but it definitely isn't right. Like you said, Self should refer to the class component and Sender should refer to the object that called that method. I don't know what happened to change this though. It was working yesterday.

But debugging it is not really possible atm, because the stabs (debug info) is not written correctly for descendants of tpersistent. It looks like it get in a loop when writting the info in gdb. I'll have to wait for Pierre MUller to get back from holiday, he's the person who coded the stabs

Peter

Reply by email

Michael A. Hess

Now this isn't correct. If you look in the dlgform.pp file of the comdialogs example you will see the buttonClick which is the procedure called by the DoOnClick TNotifyEvent. It looks like this:

procedure TSampleDialogs.buttonClick(Sender : TObject);
begin
.
.
.
end;

In the above case shouldn't the variable Self as found in this method represent a pointer to the SampleDialogs object that was created from the TSampleDialogs class? Then the data in the Sender field should be the pointer to the actual TObject (aka control) that called this event.

However the Self that is found is actually the button that fired the event. If you just print the caption and tag "writeln(caption,' ',tag); you will see that it prints the name of the button and the tag value when you click on the button. But it shouldn't. It used to.

What happened?????

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Curtis White
to Michael A. Hess

That might be why my compileroptions dialog button started crashing. In the OnClicked event, I just had Hide, which really means Self.Hide. So if Self refers to the button instead of the form, then it would be telling the button to hide. I don't quite know why this caused Lazarus to crash, but it definitely isn't right. Like you said, Self should refer to the class component and Sender should refer to the object that called that method. I don't know what happened to change this though. It was working yesterday.

Curtis

On 07-Aug-99 Michael A. Hess wrote 32 lines
Now this isn't correct. If you look in the dlgform.pp file of the comdialogs example you will see the buttonClick which is the procedure called by the DoOnClick TNotifyEvent. It looks like this: procedure TSampleDialogs.buttonClick(Sender : TObject); begin . . . end; In the above case shouldn't the variable Self as found in this method represent a pointer to the SampleDialogs object that was created from the TSampleDialogs class? Then the data in the Sender field should be the pointer to the actual TObject (aka control) that called this event. However the Self that is found is actually the button that fired the event. If you just print the caption and tag "writeln(caption,' ',tag); you will see that it prints the name of the button and the tag value when you click on the button. But it shouldn't. It used to. What happened????? -- ==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

----------------------------------
Curtis White
Curtis White
http://www.teleport.com/~osiriz/
----------------------------------

Reply by email