Solved

EASY BUTTON QUESTION!!

Posted on 1998-04-22
2
146 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
Comment Utility
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
Comment Utility
Thanks for the quick answer, it work very well!

Tony
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

8 Experts available now in Live!

Get 1:1 Help Now