Solved

EASY BUTTON QUESTION!!

Posted on 1998-04-22
2
152 Views
Last Modified: 2010-05-18
I want my users to be able to click and activate a button only 5 or so times before it becomes disabled.  How can I achieve this, in the quickes manner?

Thanks
Tony
0
Comment
Question by:aj85
2 Comments
 

Accepted Solution

by:
BigMadDrongo earned 50 total points
ID: 1335311
have a property in your form declaration for the number of times the button is clicked.  Set this to 0 at the start.  In the OnClick event of the button, increment this counter.  If the counter is 5 then disable.  E.G.

TMyForm = class(TForm)
  btn1: TButton;
private
  count: integer;
end;

procedure TMyForm.btn1Click(Sender: TObject);
begin
  inc(count);
  if count = 5 then
    btn1.Enabled := false;
end;

initialization
  count := 0;

BigMadDrongo
0
 

Author Comment

by:aj85
ID: 1335312
Thanks for the quick answer, it work very well!

Tony
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 91
Dev Express grid collapse 2 47
How to renew a Delphi rad-studio licence? 5 75
DBGrid or StringGrid ? 6 119
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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