0

I am trying to add a fade-out effect to a TMemo control.

In the Form Designer it works quite well with a TLayout, TRectangle, and TMaskToAlphaEffect, as show in the screenshot on the left side. However, I would like to use the Style Designer (TStyleBook), as this seems the predestined approach and offers even more possibilities.

I have recreated it in the Style Designer, and in the Form Designer it looks as expected.

Delphi Form Designer showing fade out effects for both TMemo controls (at runtime)

At runtime, however, the fade-out effect is not visible for TMemo styled by the TStyleBook. The "manually" styled TMemo is working fine.

Test app at runtime. The manually styled TMemo shows the fade-out effect but the the Stylebook designed TMemo has no fade-out effect.

As the Windows resources for the TStyleBook generates a ~83kb .fmx file, I had to upload the MCVE, which can be found on DropBox.

To do it on your own, follow these steps:

  1. Open new FMX project
  2. Add a TMemo to the form
  3. Right click the TMemo and select "Edit Custom Stlyes..."
  4. Select "background" under Memo1Style1 in the structure panel
  5. Add a TRectangle from the component palette by double clicking
  6. Select the Rectange1Style and change
  7. Align to "Client"
  8. Fill -> Kind to "Gradient"
  9. Add a TMaskToAlphaEffect as child from the component palette by double clicking (Rectange1Style still selected)
  10. Close the Style Designer and confirm applying the changes

If I change the Z-order of the TRectangle in the Style Designer, the effect also disappears in the Form Designer.

Am I missing something, or is it due to an incorrect Z-order at runtime, or is my approach fundamentally wrong?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Meta777
  • 11
  • 2

0 Answers0