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

x
?
Solved

EASY BUTTON QUESTION!!

Posted on 1998-04-22
2
Medium Priority
?
156 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
[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
2 Comments
 

Accepted Solution

by:
BigMadDrongo earned 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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