TGraphicControl and child controls lazarus / 39-Graphics ---------------------------------------------------------------------- Dibo · 2011-04-24 11:12 Hi, I', writting component which using BGRABitmap for drawing theme. I inherit from TGraphicControl. Drawing works fine but I can't drop child controls (like TPanel do). So I switch parent class from TGraphicControl to TCustomControl with ControlStyle := ControlStyle + [csAcceptsControls, csOpaque]. Now I can drop childs but transparency has stopped working. It seems that TCustomControl draw first some standard background with parent color. I am lock now. Regards ---------------------------------------------------------------------- lainz · 2011-04-24 15:03 Quote from: Dibo on April 24, 2011, 01:12:33 pmHi, I', writting component which using BGRABitmap for drawing theme. I inherit from TGraphicControl. Drawing works fine but I can't drop child controls (like TPanel do). So I switch parent class from TGraphicControl to TCustomControl with ControlStyle := ControlStyle + [csAcceptsControls, csOpaque]. Now I can drop childs but transparency has stopped working. It seems that TCustomControl draw first some standard background with parent color. I am lock now. Regards Go to the bugtracker. See this, they fixed my report: added transparency in controls with controls inside: http://bugs.freepascal.org/view.php?id=18172 ---------------------------------------------------------------------- Dibo · 2011-04-25 10:11 I updated lazarus svn version but still this same problem. TToolbar have no transparency too. I have linux GTK2 ---------------------------------------------------------------------- Zoran · 2011-05-04 10:23 Quote from: Dibo on April 25, 2011, 12:11:14 pmI updated lazarus svn version but still this same problem. TToolbar have no transparency too. I have linux GTK2 The solved bug that lainz points to is for win widgetset only. For Gtk2, there is separate entry in bugtracker: http://bugs.freepascal.org/view.php?id=18168 This one is not solved yet. ---------------------------------------------------------------------- camauri · 2011-05-12 22:22 Quote from: Dibo on April 24, 2011, 01:12:33 pmNow I can drop childs but transparency has stopped working. It seems that TCustomControl draw first some standard background with parent color. I am lock now. Hi Dibo, on Windows systems TCustomControl descendant aren't transparent by default. This is a correct behaviour in the LCL as in the VCL. In Mac OS X controls are native fully transparent (tested on my Mac with Lazarus ver. 0.9.28). See also here http://www.lazarus.freepascal.org/index.php?topic=9963.0. Same for GTK and QT. For transparent controls on Windows can be used the old Delphi trick. Declare TBGRAButton = class(TCustomControl)Add Messages unitAdd the following protected declarations: Code: [Select]{$IFDEF LCLwin32} procedure CreateParams(var params: TCreateParams); override; procedure WMEraseBkGnd(var msg: TWMEraseBkGnd); message WM_ERASEBKGND; {$ENDIF} Code: [Select]{$IFDEF LCLwin32} procedure TBGRAButton.CreateParams(var params: TCreateParams); begin   inherited CreateParams(params);   params.ExStyle := params.ExStyle or WS_EX_TRANSPARENT; end; procedure TBGRAButton.WMEraseBkGnd(var msg: TWMEraseBkGnd); begin   SetBkMode (msg.DC, TRANSPARENT);   msg.result := 1; end; {$ENDIF} That's all, the component is now working on Windows as transparent TCustomControl descendant. For the other platform I will try asap. Bye. Camauri ---------------------------------------------------------------------- Dibo · 2011-05-14 10:37 Hm, this trick doesn't work on GTK :/ ---------------------------------------------------------------------- camauri · 2011-05-14 16:38 Quote from: Dibo on May 14, 2011, 12:37:28 pmHm, this trick doesn't work on GTK :/ I know, this trick is for Windows only. But now BRGAControls on Windows can have the same behavior as in GTK, QT and Carbon/Cocoa. Now I'm installing Lazarus on latest Ubuntu distro to try some solutions for GTK. Next I will try on Snow Leopard. Bye. Camauri