Solved

EASY BUTTON QUESTION!!

Posted on 1998-04-22
2
153 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 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

Industry Leaders: 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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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