I have a c++ builder project in Rad Studio 12.3 to display scrolling text (left to right) on a TViewPort3D. I managed to do this by simply taking only the number of characters that fit in the area and changing the starting character for however many fit and putting just this bit of the string into a TText3D. I scroll the text by moving the starting character through the message and placing the next 30 characters into the ttext3d, effectively scrolling one character at a time. This works, but gives a jerky display and is not always using the full rectangle.
I was wondering if it is possible to render my string off screen, select the part of the rendered image I want to display and copy the bits to my displayed rectangle. That way I can step through the graphics pixel by pixel if I want, to get a consistent scroll.i
Is it possible to render firemonkey text into off screen buffer, if so how do I do this. Is it possible to copy part of this rendered image and paste into a Trect which is on the visible screen, if so how is this done, text needs to be placed over a background image..
There is a much better way to achieve this, and with no code (or some code if you wish).
TRectangle
, and on that place a TLabel
with the text you want.TLabel
's Position.X
property to 0
, and its Position.Y
property to 0
or whatever position you want it to be vertically.TRectangle
's ClipChildren
property to True
.TFloatAnimation
control on the form, and in the Structure Pane drag it to be a child of the TLabel
.TFloatAnimation
control:
Duration
: The length of time (in seconds) that the text should take to scroll all the way through.Enabled
: True
(Although it's best to leave this at False
and either call Start
or set Enabled
to True
in your code at runtime.)PropertyName
: 'Position.X'
StartValue
: 0
StopValue
: Set to the negative of the width of the text in pixels (e.g. -300
).Loop
: Set to True
to auto-repeat the scrolling.Of course you can modify these properties as required, including at run-time (e.g. Duration
if the length of the text is not known at design time). You can also set events to respond when scrolling reaches the end, or for each step of the scrolling