Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Surface Gradient
Thu, Sep 1 2016 2:26 PMPermanent Link

Walter Matte

Tactical Business Corporation

I'm trying to have a Surface Gradient - and I can't get it.  If I do FillType := ftSolid - I can get a solid surface color - but I can' get a gradient.  Is there an issue with the code below:


procedure TfrmMain.frmMainCreate(Sender: TObject);
begin
  Application.ViewPort.OverflowY:=otAuto;
  Application.Surface.ModalOverlay.Animations.Visible.Duration:=500;
  Application.Surface.ModalOverlay.Animations.Visible.Style:=asQuadEaseOut;
  Application.Surface.Constraints.Min.Height:=(Self.Height+40);
  Application.Surface.Background.Fill.Color:=clBlue;
//   Application.Surface.Background.Fill.FillType := ftSolid;   Works
  Application.Surface.Background.Fill.FillType := ftGradient;  
  Application.Surface.Background.Fill.Gradient.GradientType := gtLinear;
  with Application.Surface.Background.Fill.Gradient.ColorStops.add do
  begin
    Position := 0;
    Color := clWhiteSmoke;
  end;
  with Application.Surface.Background.Fill.Gradient.ColorStops.add do
  begin
    Position := 100;
    Color := clLightSkyBlue;
  end;
end;


Walter
Fri, Sep 2 2016 5:28 AMPermanent Link

Matthew Jones

Presumably you can see a gradient on a TPanel if you set it up manually?
What happens if you modify your code to apply it to a TPanel? (I'm
wondering if the application surface is different in some way.)
What happens if you set the fill type after adding the stops?

--

Matthew Jones
Fri, Sep 2 2016 6:47 AMPermanent Link

Walter Matte

Tactical Business Corporation

Order of FillType make no difference.

Yes Panels work!

MakeGradient(BasicPanel1.BackGround, clWhiteSmoke, clLightSkyBlue);

Surface does not.

MakeGradient(Application.Surface.Background, clWhiteSmoke, clLightSkyBlue);




procedure MakeGradient(BG : TBackground; GradientColor0, GradientColor100 : TColor);
begin                                                                                         
 BG.Fill.FillType := ftGradient;
 BG.Fill.Gradient.GradientType := gtLinear;
 BG.Fill.Gradient.ColorStops.RemoveAll;
 with BG.Fill.Gradient.ColorStops.add do
 begin
   Position := 0;
   Color := GradientColor0;
 end;
 with BG.Fill.Gradient.ColorStops.add do
 begin
   Position := 100;
   Color := GradientColor100;
 end;
end;



Walter
Fri, Sep 2 2016 7:07 AMPermanent Link

Matthew Jones

Walter Matte wrote:

> Yes Panels work!
>
> Surface does not.


Maybe this is a browser limitation? I'd use Inspect Element to see what
it thinks things are and try to spot the difference.

--

Matthew Jones
Fri, Sep 2 2016 8:39 AMPermanent Link

Michael Dreher

"Matthew Jones" wrote:

// Maybe this is a browser limitation? I'd use Inspect Element to see what
// it thinks things are and try to spot the difference.
//
// --
// Matthew Jones

I noticed the color attributes (gradient, ....) of the "surface" are attached to the (html) BODY tag, the color attributes of a TForm on the other side to a DIV tag. Is a gradient in BODY valid?

M. Dreher
Fri, Sep 2 2016 9:36 AMPermanent Link

Michael Dreher

In the firefox, I see the gradient colors when removing the "position: absolute" style from the BODY tag (see screenshot, blue gradient=body, red gradient=TForm).

Michael Dreher



Attachments: ScreenGradient.zip
Tue, Sep 6 2016 8:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Walter,

<< I'm trying to have a Surface Gradient - and I can't get it.  If I do FillType := ftSolid - I can get a solid surface color - but I can' get a gradient.>>

This may be a browser limitation, so I'll have to see what can come up with as a workaround.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Sep 6 2016 8:23 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< I noticed the color attributes (gradient, ....) of the "surface" are attached to the (html) BODY tag, the color attributes of a TForm on the other side to a DIV tag. Is a gradient in BODY valid? >>

It's valid, but there might be issues/restrictions with it due to the unique nature of the Body tag.

Tim Young
Elevate Software
www.elevatesoft.com
Image