Author: Tomas Rutkauskas
In my about box, I'd like (when the about box window is shown) to start "typing"
something (maybe in a paintbox). I mean, instead of showing some labels with the
information, the program could start typing it by itself , maybe reading the
information from an invisible memo on the same form and start writing it on the
paintbox. For example, it could start writing letters one by one and making them
sentences, also leave the spaces required and also show a graphic " | " after
anything written (like in the edit controls). Could someone show some code of doing
that? To better explain, I'd like to simulate the "typing" like someone is typing
on the screen, leaving spaces, writing pauses, semicolons , etc.
A way would be to put a timer on the aboutbox, and every timer click draw add an
extra character. It may be best to use a TImage and draw the chars to the image.
That way they will stay without needing a redraw. Here are the basic steps:
Include the text to type in a memo.
On create move the memo off screen (make invisible), set variables of say ml=memo,
line=0, sp=string, position=-1, Xpos:= 0, Ypos:= 0, tmpstr:= ''
On a timer do
2 if (sp = -1) then
4 ypos := ypos + image1.canvas.textheight('A');
5 xpos := 0;
6 tmpstr := memo1.lines[ml];
8 sp := 1;
10 Image1.Canvas.TextOut(xpos, ypos, tmpstr[sp]);
12 xpos := xpos + image1.canvas.textwidth('A');
13 if (sp > Length(TmpStr)) then
14 sp := -1;