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

x
?
Solved

Button with 2 actions

Posted on 2006-10-30
3
Medium Priority
?
214 Views
Last Modified: 2010-04-01
Hi i use BC++ and i want to use button to handle two actions
like first click do action 1
second click do action 2 and so
0
Comment
Question by:altra22
[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
3 Comments
 
LVL 3

Expert Comment

by:loki982
ID: 17839154
an easy way to go about this would be to connect the button to an intermediate slot where you could increment a member variable
from there you could create some logic on that member variable to determine what functions to call from there
0
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 200 total points
ID: 17847293
just use a static int:

static int numClicked = 0;
numClicked++;

switch (numClicked)
{
 case 1:
   //do something
   break;
 case 2:
   //do something else
   break;
 default:
   //more than 2 clicks....
}
0
 
LVL 2

Author Comment

by:altra22
ID: 17858594
Thanks
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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