Solved

Speedbutton autorepeat

Posted on 2000-02-22
5
681 Views
Last Modified: 2008-03-17
Hi all,

I need a SpeedButton whith ability to execute OnClick event procedure repetitively while in Down position.
I've tried with Timer checking if SpeedButton.Down property is True, but it doesn't work.
I suppose there is some smart way to do it using standart component TSpeedButton, but don't know it.

Jo.
0
Comment
Question by:Fatman121898
5 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 50 total points
ID: 2546741
Try this:

procedure TForm1.SpeedButton1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  //Start the timer
  Timer1.Enabled := TRUE;
end;

procedure TForm1.SpeedButton1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  //End the timer
  Timer1.Enabled := FALSE;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  //Do what we need to do
  Label1.Caption := IntToStr(iCount);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  iCount := iCount + 1;
  //Force a 'click'
  SpeedButton1Click(Self);
end;

This works fine for me. The code runs, and increments (and displays) iCount, putting the results into Label1.

Did you have the interval on your TTimer set correctly? In my code it's set to 100

The Neil
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2546777
FatMan,

Don't you've the FREE RX-Lib? This is a library every developer needs :-). Why? It's free and with source... Thus you can learn a lot form it.... AutoRepeat SpeedButtons are also included...

www.rxlib.com

Zif.
0
 
LVL 1

Author Comment

by:Fatman121898
ID: 2546942
The Neil got the points.
That was what I needed.

Zif, I know aboout RX, thanks.

Jo.
0
 
LVL 17

Expert Comment

by:geobul
ID: 2546962
Hi Fatman,

Set AllowAllUp to true and GroupIndex to 1. Then the timer will work.

Regards, Geo
0
 
LVL 1

Author Comment

by:Fatman121898
ID: 2547028
Hi Geo,
She imam da cherpya pri Samito :-)
Ama utre.
Jo.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 120
error 1.1 400 Bad request idhttp delphi 18 55
Tembedded WB animatid gifs not animated on some pcs 2 73
Base1 Encode/Decode 3 68
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now