Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-04

Frame3D

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Weustink
to Juha Manninen: I am trying to port ESSModel Delphi program. There is: Frame3D(Canvas, Rect, TopColor,…
Juha Manninen wrote 11 lines
I am trying to port ESSModel Delphi program. There is: Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth); the best replacement in LCL I found is: Canvas.Frame3D(Rect, BevelWidth, bvLowered); but it has a very different parameter signature. The original has 2 TColor parameters. How to port it properly?

I wonder. I've added the Frame3d to the canvas with the same params as the functional frame3d (and iirc i wrote a wrapper)

Marc

Reply by email

Juha Manninen

I am trying to port ESSModel Delphi program.

There is:
    Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
the best replacement in LCL I found is:
    Canvas.Frame3D(Rect, BevelWidth, bvLowered);

but it has a very different parameter signature.
The original has 2 TColor parameters.
How to port it properly?

Juha

Reply by email

Paul Ishenin
to Juha Manninen
Juha Manninen wrote 12 lines
I am trying to port ESSModel Delphi program. There is: Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth); the best replacement in LCL I found is: Canvas.Frame3D(Rect, BevelWidth, bvLowered); but it has a very different parameter signature. The original has 2 TColor parameters. How to port it properly?

Usually Frame3D is used with clBtnHighlight, clBtnShadow colors - to draw raised or lowered surface. The best match on most widgetset would be to use Canvas.Frame3D for that purpose - then surface will look more native.

But if you need paticular colors and the same as in delphi Frame3D look then just use the same algorithm as in delphi: Left, Top sides are drawn with TopColor, Right,Bottom with BottomColor.

Best regards,
Paul Ishenin.

Reply by email

Diogo Piçarra
to Paul Ishenin
Paul Ishenin voc? wrote 21 lines
16.04.2010 17:01, Juha Manninen wrote: > I am trying to port ESSModel Delphi program. > > There is: > Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth); > > the best replacement in LCL I found is: > Canvas.Frame3D(Rect, BevelWidth, bvLowered); > > but it has a very different parameter signature. > The original has 2 TColor parameters. > How to port it properly? Usually Frame3D is used with clBtnHighlight, clBtnShadow colors - to draw raised or lowered surface. The best match on most widgetset would be to use Canvas.Frame3D for that purpose - then surface will look more native. But if you need paticular colors and the same as in delphi Frame3D look then just use the same algorithm as in delphi: Left, Top sides are drawn with TopColor, Right,Bottom with BottomColor.

There's already an Frame3D implementation in the bugtracker: http://bugs.freepascal.org/view.php?id=8328

Thx
Diogo Pi?arra

Reply by email

Juha Manninen
to Diogo Piçarra

Hi

There's already an Frame3D implementation in the bugtracker: http://bugs.freepascal.org/view.php?id=8328

You are right. I also noticed there a comment from Marc Weustink: ---------
@Xpete: wouldn't id be better than to replace the exing TCanvas.Frame3D with the delphi compatible implementation ? (or as overloaded method) IMO, it makes no sense, when we're using OO, to add a procedural function with the object as first parameter. To be compatible with Delphi we can allway add a function to ExtCtrls like:

procedure Frame3D(ACanvas: TCAnvas; ...);
begin
  ACanvas.Frame3D(...);
end;
----------

I also like the OO version more and don't think it is even necessary to add a "Frame3D(ACanvas: TCAnvas; ...);" version.
"TCanvas.Frame3D(...)" is better if the parameter signature is otherwise identical. It would be trivial to replace the Delphi version with it when converting code.

The patch may have too many things squeezed in.
If TFlatButton was rejected then the other functions were ignored, too.

Would it be possible to get this procedure:
Procedure TCanvas.Frame3D(Var Rect: TRect;
  TopColor: TColor; BottomColor : TColor; FWidth: Integer);

and maybe the others from the patch even if TFlatButton was rejected.

Juha

Reply by email