[Lazarus] TDBNavigator button click
Howard Page-Clark
hdpc at talktalk.net
Sat Mar 13 18:45:28 CET 2010
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
More information about the Lazarus
mailing list