Recent

Author Topic: How to send anything direkt to label1?  (Read 3132 times)

coradi

  • Full Member
  • ***
  • Posts: 148
How to send anything direkt to label1?
« on: February 15, 2015, 12:28:23 pm »
Hi,
I try to show the Time.
This work if I write the routine into Button1click and send the value to label1.
But I would start it in an loop and send the time all the time to label1.
But with this it sais that Label1 not found.
I think my fault is to understand to work with Rekords?

Code: [Select]
{ TForm1 }

procedure TForm1.Label1Click(Sender: TObject);
begin

end;   

and

Begin
 While TRUE DO
Begin
  Label1.Caption := TimeToStr(now);
  end;
end; 
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

balazsszekely

  • Guest
Re: How to send anything direkt to label1?
« Reply #1 on: February 15, 2015, 12:50:54 pm »
Drop a TTimer to your form, set Interval to 10. Double click the TTimer:
Code: [Select]
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  label1.Caption := FormatDateTime('hh:mm:ss:zzz', now);
end;

PS: If you want a more precise timer, you should create a thread.

coradi

  • Full Member
  • ***
  • Posts: 148
Re: How to send anything direkt to label1?
« Reply #2 on: February 15, 2015, 12:59:29 pm »
ah ok, for first try, this will work :-)

And If I try to PRgramm something liek a calculator..how can I do, that If I press Button 1 that send the numer 1 to label...and press it again, that label is not 1 ..they should be 11 and so on..

No, it't not for Homework :-)
I'm try to learn FPC :-)
and need motivation Projekts :-)
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

balazsszekely

  • Guest
Re: How to send anything direkt to label1?
« Reply #3 on: February 15, 2015, 01:06:04 pm »
Quote
No, it't not for Homework :-)
Yes, it is! But I don't care!  :D

Click Label1, set Caption property to ''.
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := Label1.Caption + IntToStr(1);
end;

coradi

  • Full Member
  • ***
  • Posts: 148
Re: How to send anything direkt to label1?
« Reply #4 on: February 15, 2015, 01:14:40 pm »
really!! no homework.
Great this works, it was to easy, I think I am to intelligent for this easy stuff that I can't found it haha
Thanks
I liek the Pascal Community it's much more friendly than the C Freaks
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

balazsszekely

  • Guest
Re: How to send anything direkt to label1?
« Reply #5 on: February 15, 2015, 01:16:26 pm »
Quote
I liek the Pascal Community it's much more friendly than the C Freaks

I agree with you on this one 100%.

 

TinyPortal © 2005-2018