Animated, Scrolling, Marquee Style Text in Delphi Programs ( Text Perjalanan )



Marquee Label Caption

We can customize the scrolling text by setting options such as direction of travel and speed. The string (message) displayed by the Label component is held in the Edit component's Text property.
We will also need to place a TTimer and a TUpDown component on the form. The Interval property of the TTimer determines the speed of the scrolling. With the TUpDown component we adjust the scrolling speed (Timer.Interval property).
To set the traveling direction we use TRadioGroup component with two items: Left and Right. For example, when Left option is selected, the text scrolls from right to left.
The "Start/Stop" button is used to stop and start text scrolling.

Marquee Code

The main code that scrolls the text lies in the OnTimer event of the TTimer component. Let's see how it looks:
 procedure TForm1.Timer1Timer(Sender: TObject) ;
 var
   txt : string;
 begin
   txt := lblMarquee.Caption;
 
   if rgDirection.ItemIndex = 0 then {left}
    lblMarquee.Caption :=
      Copy(txt, 2, Length(txt) - 1) + Copy(txt,1,1)
   else {right}
    lblMarquee.Caption:=
      Copy(txt, Length(txt)-1,1) + Copy(txt, 1, Length(txt)-1) ;
 end; 
What a confusing code, someone might say. Let's see what happens if the direction is set to left:
Suppose that before the OnTimer event we have the following message displayed in the "traveling" label: "DELPHI". What we want to achieve is to have "ELPHID" displayed after the OnTimer event - this will give the illusion of scrolling. Note that letter "D" comes after "ELPHI": we simply cut the first character of the message and move it to the end of message.
Note: String handling function Copy returns a substring of a string, and Length returns the number of characters in a string.
 txt := 'DELPHI';
 
 //cut ELPHI from DELPHI
 Copy(txt, 2, Length(txt) - 1)
 
 //cut D from DELPHI
 Copy(txt,1,1) 

Download the Marquee project's code

Making students database using Delphi and link it with MS Access database




       this task is how to make an application using Delphi and link it with MS Access database, the job done and i really enjoyed it :) .. to download the application with database file Click Here.