[Lazarus] Window body dragging

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sun Jan 3 04:13:29 CET 2010

Felipe Monteiro de Carvalho schrieb:

> I am investigating how to make a component act like the title bar, in
> the sense that it can be used to drag the window around.

Is this investigation related to docking?

When you are interested in non-rectangular windows, without a title bar, 
I have no idea how to implement that.

> We have 2 solutions at the moment:
> 1 - Use MouseMove, MouseUp, MouseDown to emulate this, but in my Mac
> it sometimes looses track of MouseMove because the mouse was faster
> then the window, so not 100% good
> 2 - Use platform-specific APIs. It's easy in Windows and we already
> have an idea in X11, but nothing yet in Carbon.
> Has anyone tryed this before and knows if option 1 is good enough or
> how to implement 2 well?

Actually different window managers are involved, not bound to specific 
widgetsets. It may be easier to ignore the existence of such window 
managers, instead of adding another dimension to the already existing 
choice of an targetOS and an widgetset.

I had an idea to add another docking button to the title bar of a 
window, that can be used to emulate dragging forms without assistance by 
the window manager. Since I couldn't implement such an button myself, I 
added an dock grip icon (red pin) to all dockable forms. That workaround 
interferes with the child controls of the windows, and is mereley a 
proof of concept instead of a solution for dragging forms.

A slightly different implementation could check e.g. the CTRL key, in 
order to distinguish between moving and dragging forms from the title 
bar. This solution would not change the appearance of the title bar, but 
I have no idea whether it's feasable with the various window managers.


More information about the Lazarus mailing list