[lazarus] Latest source is attached.

Michael A. Hess mhess at miraclec.com
Fri Jul 2 21:46:23 EDT 1999


Shane Miller wrote:
> 
> I'm a bit confused yet on the implementation.

I'm not surprise I really didn't go into great detail as to the
connection between the gtk callback and how it is set up. All I was
trying to do at this point was show you all that would be needed in the
FCL if I can get my messaging scheme working.

> Do you have any code that shows this yet?

As I mentioned I do have all the code added to TControl and the required
GTK stuff in GUIAPI to make this work. It should work but I was having
problem with the compiler before. The compiler just finished doing a
fresh cycle from CVS as I type this line. I don't think I will get a
chance to actually try a compile of my lazarus code tonight but I'll do
so tomorrow. When I have it working or at least cleaned up for you to
look at I'll sent it to you. (probably post a link to my ftp where the
code will be)

> I think I understand but if I understood when/how you used
> Dispatch(str) I think I would understand a bit better.

The GUIAPI_Set_Callback routine actually calls the gtk_connect stuff and
it uses a method found in TControl that ALL gtk_connects attach to. This
routine calls the DispatchStr with the correct message. This then
filters up through the messaging chain.

> Does that actually work now?

It should give me a day to run it through the new compiler.  :-)

> Does it send a "string" message to the "self" component?  Are we
> supposed to do that after we receive a "signal" or does that replace
> it?

The code I showed in my email is ALL that would be required of ANY
component. You would never have to do anything more then you see there.
If your component needed to receive a 'resize' message you would simple
put the following in your class.

protected
   procedure DoResize(Self : TCustomForm); message 'resize';


then actually write the procedure

procedure TCustomForm.DoResize(Self : TCustomForm);
begin
   if Assigned (FOnResize) then
      FOnResize(Self);
end;

and the following in your create.

   GUIAPI_Set_Callback('resize', Self)


You would add this for any message you wanted to receive. Of course the
GUIAPI would have to know about this kind message but if it didn't
already know about it you would just add it.
 
> If it replaces it, how do we watch for a resize without trapping the
> signal from the gtk widget?

You are getting the signals from the gtk widgets. It is just that
instead of each component needing to call the gtk_connect and write a
specific method to handle the callback, all callbacks go to just one
method found in the TControl component. Then the built in message
dispatcher passes it to the correct location.

As I said give me a day or two at most and I send you code. I won't
commit it to CVS until we get a chance to go over it together.

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

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






More information about the Lazarus mailing list