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.
At runtime, however, the fade-out effect is not visible for TMemo
styled by the TStyleBook
. The "manually" styled TMemo
is working fine.
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:
- Open new FMX project
- Add a TMemo to the form
- Right click the TMemo and select "Edit Custom Stlyes..."
- Select "background" under Memo1Style1 in the structure panel
- Add a TRectangle from the component palette by double clicking
- Select the Rectange1Style and change
- Align to "Client"
- Fill -> Kind to "Gradient"
- Add a TMaskToAlphaEffect as child from the component palette by double clicking (Rectange1Style still selected)
- 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?