Sign in Join

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

Mailing lists / lazarus / 1999-07

Lazarus messaging

7 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Michael A. Hess
to Shane Miller: Yes. I see that. that is very cool, and actually works! I got the insert text signal…
Shane Miller wrote
TMemo's is a bit more complex than TButton of TForms. :-)

I can understand that. :-)

I am working on modifing the TCustomDialog and the TOpenFileDialog and it is also somewhat more complicated than those 2 but not near as complex as TMemo.

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

Reply by email

Shane Miller

Yes. I see that. that is very cool, and actually works! I got the insert text signal working for TMemo. It send the record to it so it knows what's been added. Pretty slick.

My biggest problem I am having now is to find some way for the TMemo to realize that it's been changed. If people do a Memo1.Lines.Add('This is cool!'); I have to find a way to let the TMemo class know something was added to it's lines property. I believe it's done through TMemoStrings.SetUpdateState but I'm not quite sure yet.

TMemo's is a bit more complex than TButton of TForms. :-)

Shane

>> "Michael A. Hess" 07/12 10:24 AM >>>
Shane Miller wrote 11 lines
What is sent, or how do you control what is sent in the "msg" portion of the message procedure? What is being sent there? Can we control it. The reason we need to control it is because when dispatching we need some way to send info to the message procedure. For example: GTKTEXT has a signal called INSERT-TEXT. The probelm is it sends the new text, new text length, and position. How do we use that in our class. How do we send that?

Not a problem. We will have to constantly adjust some of the SetCallback routines and add some additional more complex versions. But here is what needs to be done. The msg being sent to the Dispatch is a var msg. In other words it can be anything it wishes. In our basic SetCallback the value being passed is just the number used to indicated which message we are calling (LM_CLICK, LM_RESIZE, etc.). However the msg can just as easily be a complex record with the first item in the record being a cardinal containing the message, LM_CLICK, etc.

In the callback routine that GTK is calling, you will just have to build a complex record and that is the information you pass to the Dispatch call. As long as the first item in the record is the message, you are cooking. Look in the current documentation under Dispatch for an example of this.

==== 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

Reply by email

Shane Miller

I have just updated CVS. This version has two things changed: When you resize a TForm, you can see it in the console window. It tells you it's width and height so you know your getting the signal correctly.

The memo does not color the file correctly. I screwed it up but will fix it later. I am going to work on the resizing of child controls right now.

I am going to base it on the control's alignment property. Each control should have an alignment.

Shane

>> 07/12 12:37 PM >>>
Shane Miller wrote
Yes. I see that. that is very cool, and actually works! I got the insert text signal working for TMemo. It send the record to it so it knows what's been added. Pretty slick. My biggest problem I am having now is to find some way for the TMemo to realize that it's been changed. If people do a Memo1.Lines.Add('This is cool!'); I have to find a way to let the TMemo class know something was added to it's lines property. I believe it's done through TMemoStrings.SetUpdateState but I'm not quite sure yet.

Simply set the TStrings OnChange event:

Constructor TMemo.Create (AOwner : TComponent)
begin
  MemoStrings:=TStringList.Create;
  ;
end;

Any time the MemoStrngs stringlist changes, you are notified.

Michael.

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael Van Canneyt
to Shane Miller: Question: What is sent, or how do you control what is sent in the "msg" portion of the…
Shane Miller wrote 6 lines
Question: What is sent, or how do you control what is sent in the "msg" portion of the message procedure? What is being sent there? Can we control it. The reason we need to control it is because when dispatching we need some way to send info to the message procedure. For example: GTKTEXT has a signal called INSERT-TEXT. The probelm is it sends the new text, new text length, and position. How do we use that in our class. How do we send that?

The Dispatch() procedure accepts any structure as a parameter. Only the first cardinal must be the message number.

So you could define

  TInsTextMessage = Record
    MsgID : Longint;
    TheText : Pchar;
  end;
And do a
var
  Msg : TInstTextMessage;
begin
  Msg.MsgId:=GTK_INSTEXT;
  Msg.TheText:='some nice text';
  Dispatch(Msg);
end;
---------------------------

This is explained in the docs. I recommend making a record for any kind of message, and just using these records.

Michael.

Reply by email

Michael A. Hess
to Shane Miller: Question: What is sent, or how do you control what is sent in the "msg" portion of the…
Shane Miller wrote 11 lines
What is sent, or how do you control what is sent in the "msg" portion of the message procedure? What is being sent there? Can we control it. The reason we need to control it is because when dispatching we need some way to send info to the message procedure. For example: GTKTEXT has a signal called INSERT-TEXT. The probelm is it sends the new text, new text length, and position. How do we use that in our class. How do we send that?

Not a problem. We will have to constantly adjust some of the SetCallback routines and add some additional more complex versions. But here is what needs to be done. The msg being sent to the Dispatch is a var msg. In other words it can be anything it wishes. In our basic SetCallback the value being passed is just the number used to indicated which message we are calling (LM_CLICK, LM_RESIZE, etc.). However the msg can just as easily be a complex record with the first item in the record being a cardinal containing the message, LM_CLICK, etc.

In the callback routine that GTK is calling, you will just have to build a complex record and that is the information you pass to the Dispatch call. As long as the first item in the record is the message, you are cooking. Look in the current documentation under Dispatch for an example of this.

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

Reply by email

Shane Miller

Question:
What is sent, or how do you control what is sent in the "msg" portion of the message procedure? What is being sent there? Can we control it.

The reason we need to control it is because when dispatching we need some way to send info to the message procedure. For example:

GTKTEXT has a signal called INSERT-TEXT. The probelm is it sends the new text, new text length, and position. How do we use that in our class. How do we send that?

Shane

Reply by email

Unknown author
to Shane Miller: Yes. I see that. that is very cool, and actually works! I got the insert text signal…
Shane Miller wrote
Yes. I see that. that is very cool, and actually works! I got the insert text signal working for TMemo. It send the record to it so it knows what's been added. Pretty slick. My biggest problem I am having now is to find some way for the TMemo to realize that it's been changed. If people do a Memo1.Lines.Add('This is cool!'); I have to find a way to let the TMemo class know something was added to it's lines property. I believe it's done through TMemoStrings.SetUpdateState but I'm not quite sure yet.

Simply set the TStrings OnChange event:

Constructor TMemo.Create (AOwner : TComponent)
begin
  MemoStrings:=TStringList.Create;
  ;
end;

Any time the MemoStrngs stringlist changes, you are notified.

Michael.

Reply by email