Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
Member Area
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Become a Member
-Why sign up!
-Chat Online!
-Indexes NEW!!
-Build your resume
-Find a job
-Post a job
-Resume Search
-Link to us
Visit Embarcadero
Embarcadero Community
How to create a Typing Simulation in an about box Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Delphi All Versions
User Rating
No Votes
# Votes
DSP, Administrator
Reference URL:
			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

1   begin
2     if (sp = -1) then
3     begin
4       ypos := ypos + image1.canvas.textheight('A');
5       xpos := 0;
6       tmpstr := memo1.lines[ml];
7       Inc(ml);
8       sp := 1;
9     end;
10    Image1.Canvas.TextOut(xpos, ypos, tmpstr[sp]);
11    Inc(sp)
12      xpos := xpos + image1.canvas.textwidth('A');
13    if (sp > Length(TmpStr)) then
14      sp := -1;
15  end;

Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10


Share this page
Download from Google

Copyright © Mendozi Enterprises LLC