Recent

Author Topic: how (Delphi for Lazarus) ?  (Read 11285 times)

Onjahyr-BR

  • Full Member
  • ***
  • Posts: 121
how (Delphi for Lazarus) ?
« on: September 12, 2006, 07:05:24 pm »
Transparent Panel

=====================================
interface
uses Windows, Messages;

type
  TStoTransparentPanel = class(TWinControl)
  private
    procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBKGND;
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

implementation

procedure TStoTransparentPanel.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.ExStyle:= Params.ExStyle or WS_EX_TRANSPARENT;
end;

procedure TStoTransparentPanel.WMEraseBkgnd(var Message: TWmEraseBkgnd);
begin
  // in this case, we want to intercept the windows message. if we would want to
  // pass the message to the ancestor classes, we could use the keyword
  // "inherited" without the procedure name. example:
  //   inherited;
  Message.Result := 1;
end;

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2519
RE: how (Delphi for Lazarus) ?
« Reply #1 on: September 12, 2006, 11:32:37 pm »
ehmmm... what is the use of a transparent panel ?
Can't you palce the components on the container below it ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Dr.Theopolis

  • Jr. Member
  • **
  • Posts: 69
Need transparent panel
« Reply #2 on: December 06, 2007, 09:45:38 pm »
Transparent panels are extremely useful in situations where you want the items it contains to be overlaid on top of other components that tend to want to be in the foreground regardless of their zorder - like TEdits. For example, if I have a TImage with a transparent background and want it to be on top of EVERYTHING else on a form, it will not work if you have controls like TEdits on your form.

Anyway...I tried the above code and it did not work. Has anyone accomplished transparent panels in Lazarus?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2519
RE: Need transparent panel
« Reply #3 on: December 07, 2007, 11:06:18 am »
We were working on it and we couldn't even find a solution which would work for all windows versions. So a bit frustrated it was postponed till some one comes with an idea for a workable solution.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

craigTheBrit

  • New member
  • *
  • Posts: 6
    • http://www.handform.net
RE: Need transparent panel
« Reply #4 on: December 12, 2007, 04:31:15 pm »
The way I've implemented some transparent controls in the past is to instruct the parent control to invalidate the area the component covers:

        r := Rect(left, top, left+width, top+height);
        InvalidateRect(Parent.Handle, @r, true);

One issue is that this starts a never-ending chain of redrawing, so you have to make sure it only happens once when the component is moved or changes its appearance... hmm guess it's not ideal...

Dr.Theopolis

  • Jr. Member
  • **
  • Posts: 69
Semi-transparent and fading in/out controls
« Reply #5 on: December 12, 2007, 11:48:36 pm »
What would be great is if we could figure out how to have a control copy the screen canvas below it into its own canvas. That way, the control could have a chance to also apply semi-transparencies. Also, the control could accomplish fading in and out.

Fred vS

  • Hero Member
  • *****
  • Posts: 2085
    • StrumPract is the musicians best friend
Re: how (Delphi for Lazarus) ?
« Reply #6 on: March 30, 2013, 03:31:13 pm »
Hello everybody  ;D

Some news about that famous Transparent Panel ( for Windows, Linux, OsX,... ) ?
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

 

TinyPortal © 2005-2018