Standard way to create 'Transparent' controls is to override the paint messages and insert the 'background' you want after inherited and before your contained painting. You get the background from requesting a paint from the parent of your control.
Eg in windows you would create an HDC, and send a WM_PAINT to the parent control, then based on your own coordinates blit what you want into your control. Delphi has some encapsulation around that (as I recall, been a few years since I needed to do this). Now, whether all widgetsets will support this for use in Laz is another matter - can we tell a control to paint itself to an arbitrary canvas? I have a feeling that OSX might complain, since (from what I understand) paint cycles are primarily OS based, and a process draw-request might be offensive.. As for GTK.x I couldn't say. But that's essentially the way to do it. You _could_ do it by for going the inherited call, and just paint onto whatever canvas you are given - but from experience I can say that this can be unreliable: it's worth the small overhead of getting the parent background. HTH DSP -----Original Message----- From: Graeme Geldenhuys [mailto:[email protected]] Sent: 22 December 2009 14:32 To: Lazarus mailing list Subject: Re: [Lazarus] csOpaque seems to be broken in 0.9.29 Paul Ishenin wrote: >> > csOpaque is a hint which component gives to lcl whether it fully draws > itself or not. It does not mean that component should be drawn > transparently. To be fair, I did try and find help on csOpaque, but there was none. I then searched the LCL and found the following code with comment. I assumed from that, that csOpaque means the component will be transparent. ---------------------------------- constructor TCustomPanel.Create(TheOwner : TComponent); begin inherited Create (TheOwner); FCompStyle:= csPanel; ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse, csClickEvents, csSetCaption, csDoubleClicks, csReplicatable, csNoFocus] - [csOpaque]; // we need the default background ... ---------------------------------- > Moreover it can't work for TWinControl which has a window > - HWND or GdkWindow since that windows are not transparent. So how else would you create a transparent container component in LCL? Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
