Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Speedbutton autorepeat

Posted on 2000-02-22
5
Medium Priority
?
701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 150 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

598 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