#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    europe
    Posts
    274
    Rep Power
    0

    Question DateTimeToStr(); on status bar?


    hi guys,
    i need a small help, as you can imagine from the thread title i m learning delphi language.

    the problem now is i tried to put the DateTimeToStr(now); function on status bar.

    i need it once the form load. i tired with onLoad event.
    what is the best event to use. to have to once the form starts?

    Code:
    var statustime : string;
    statustime := ' The Date and Time is: ' + DateTimeToStr(Now)+ ' .';
    caption.text.statustime;
    hope you got my problem

    thanks
    -stagy
    hmm...
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Italy
    Posts
    63
    Rep Power
    12
    Date should be converted to string
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Try this:
    1. Set the SimplePanel property of the Statusbar component to True.
    2. On the OnActivate event, add this line:
    Statusbar1.SimpleText := DateTimeToStr(Now);

    If you want the time to keep updating every second, do this:
    1. Drop a TTimer Component on the form (it's on the System tab of components).
    2. Set the Interval property as needed (or keep the default 1000, which is 1 second).
    3. On the Timer's OnTimer event, add this line:
    Statusbar1.SimpleText := DateTimeToStr(Now);
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo