[lazarus] Non-visual component drawing

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Oct 26 17:34:57 EST 2003


On Sun, 26 Oct 2003 20:14:41 +0100
Micha Nelissen <M.Nelissen at student.tue.nl> wrote:

> Nelissen, M. wrote:
> 
> > Can someone tell me how non-visual components are drawn on forms in the 
> > designer in gtk/lazarus ? Is it done in designer/, or in the interface? 

designer


> > In win32, they are clickable, but not visible.
> 
> Ok, did some research myself. It seems that the gtk interface sends a 
> designer specific INTERNALPAINT message from gtkobject.inc:1176 to the 
> lcl, which is then handled by designer.pp and passed on to 
> controlselection for drawing grid and grabbers etc.
> 
> Please, is there no other way? This is real ugly; having to send this 
> from the interface with specific non-documented behaviour for the 
> lazarus ide.
> 
> Can the designer form override the Paint method and do it that way?

The designer can't override any method, because any component can also do
so. But this is not required anyway, because the designer is using the
message queue of the form (like Delphi). It uses all paint messages (PAINT
and INTERNALPAINT). The reason for the extra INTERNALPAINT messages is
simple: The paint messages from the gtk interface are not sufficient. A LCL
control can consist of several internal widgets in the gtk-interface. The
normal paint message is only sent for the main widget. But the designer
wants to paint on everything, so the gtk-interface has to send special paint
messages for the internal widgets. (Another solution would be to create one
special paint message for all widgets of the control. But this is an
optimization for the gtk-interface. The designer should not bother.)

For win32 the normal paint messages should be enough. Please test, if the
designer is getting the paint messages and if they are handled at the right
time (after letting the control draw itself). 
Maybe we need to adapt the BeginPaint, EndPaint to the designer.


Mattias






More information about the Lazarus mailing list