[lazarus] Creating Components...

Michael A. Hess mhess at miraclec.com
Thu Aug 12 09:53:45 EDT 1999


Jeff Wormsley wrote:
>  
> In other words, I would have the LCL TButton, and then a
> TWin32Button in the interface.  This seems to be the way GTK operates,
> with all of its widgets already made and (at least in Win32) stored in
> the shared libraries (GTKDLL's), and GtkInt maps an LCL control to a
> Gtk widget.

That is exactly the same thing you are doing with the Windows API. The
GTK library is just calls to create the widget. It passes the handle of
the widget it created back to you. That is what gets stored in the
fComponent variable. This is a pointer to the allocated memory that is
the object information (aka widget).

In the Win32 stuff you are doing exactly the same thing by calling the
CreateWindow function. It is returning the HWND handle which is the
pointer to the memory area that contains the object information. This
should also be stored in fComponent.

The different between GTK and Windows is that you create every control
with the same CreateWindow function and just pass it a different type of
item to create. In GTK a separate function exists for each individual
kind of widget.


> My big hurdle right now is that for every 1 LM_xxxx message, there
> seem to be 5 or 6 WM_xxxx messages that it takes to do that task.  For
> instance, LM_CREATE causes a window to be created, which fires about 5
> windows messages, starting with WM_GETMINMAXINFO (from memory), and
> ending with WM_SHOWWINDOW.

Why is that a problem? This would be a message that is begin sent to the
WindowProc for the control, correct? If it is something the control
needs to handle well then just pass it on with the correct LM_XXX
message. If it is something that really isn't used and can be ignored
well then just ignore it in the callback (WindowProc) routine. If it is
something that every control would receive and it is something that
might need to be handled by the LCL control well then add it to the
control.

Add this new message (LM_YYYY) to the list of messages and then add this
handler to the basic TControl class.

procedure DoYYY(var msg); message LM_YYY;

Then of course add the DoYYY procedure to the controls.inc file. Just
because it isn't something that GTK sends back to the control doesn't
mean we can't add it for Windows.


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