Yes, it works but Button1Exit is not the best because it control the focus and when i click on button the focus remain on the button. I will try to change focus or maybe TButton.OnMouseDown and the timer event... Thank you for the idea, you woke up my brain ;)
Andy. Howard Page-Clark ha scritto: > On 13/3/10 3:42, andtag wrote: >> Hello, >> I have a DB with 400 records and clicking the next button i can see the >> next record. If i want to reach record 200 i must do 200 clicks. >> I want to have a continue action pressing the dbnavigator button, for >> example, when i click Next button, i want the records go forward until i >> leave the button. Is possible to do? > Is something like this what you are looking for? > > Add a boolean FButtonHeldDown as a private variable of TForm1, and a > normal button, Button1. Add this code to OnClick and OnExit events of > Button1. > > procedure TForm1.Button1Click(Sender: TObject); > var sequence: integer; > begin > FButtonHeldDown := true; > sequence := 0; > while FButtonHeldDown and not dbf1.EOF do > begin > dbf1.Next; > inc(sequence); > label1.Caption := Format('cursor moved forward %d times',[sequence]); > Application.ProcessMessages; > Sleep(100); > end; > end; > > procedure TForm1.Button1Exit(Sender: TObject); > begin > FButtonHeldDown := false; > end; > > >> exists a function for know if a button is pressed down, not only >> a click? > TButton.OnMouseDown? > > Howard > > -- > _______________________________________________ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus