Autor Beitrag
joelrodrigues
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 20



BeitragVerfasst: Do 08.02.07 21:28 
(sorry, but i don´t speak german and this forum is the best Delphi Forum i know).

Hi folks,


I have LABEL1 component in my Form1. This label is INVISIBLE (LABEL1.Visible := false).

When I press any key (Form1.OnKeyPress or Form1.OnKeyDown), my LABEL1 must be visible (so, LABEL1.Visible := true).

Now, when i release the key pressed (Form1.OnKeyUp), i´d like my LABEL1 get invisible but not in the same moment the person release the KEY pressed, but only after 2 seconds later. In other words, after i release the key pressed, i still seeing my LABEL1 until 2 seconds later, when my LABEL1 must be invisible (LABEL1.Visible := false).

Any idea how could i implement this code?
It seems simple, but i am having finding some troubles.

Any help (better with examples) will be appreciated!

Thanks very much!

JOEL RODRIGUES
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 08.02.07 21:34 
Either you work with a timer or you use Sleep(TimeInMs); ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Do 08.02.07 21:39 
Use a Timer. (System-tab)
Put in a 2000-Interval and set it Enabled:=false;
in the onKeyUp Event you just put in Timer1.Enabled:=true;
The Timer-Event should be like this:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
   Label1.Visible:=false;
   Timer1.Enabled:=false;
end;

So after the timer is enabled, it would do the procedure every 2 seconds over and over again, that's why you deactivate it at once.
Should work this way and the program isn't frozen which is what sleep(2000) would do.

Oh, and: Please change the title of your topic so tells us what's your problem about ;)

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 08.02.07 21:54 
Hello!

Please choose another title for your topic. A good title tells the reader something about the problem you want to solve.

In order to edit the topic title, please click this image user defined image in your first posting and enter a new title.

Thank you
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".