For example, I want to set flag so that when I click a mouse down a screen schows up. I got that. But when I take my finger off of the button it disappears. Does anyone know how to set up a falg so that doesn't happen?

 switch(id)
      {
         case BUTTON_ID_1:
 if(state == UGP_BUTTON_DOWN)  TeaPotFPS();

break;

For example, I want to set flag so that when I click a mouse down a screen schows up. I got that. But when I take my finger off of the button it disappears. Does anyone know how to set up a falg so that doesn't happen?


switch(id)
{
case BUTTON_ID_1:
if(state == UGP_BUTTON_DOWN) TeaPotFPS();

break;

I don't know what the rest of your code looks like, so it's hard to speculate, but I imagine that if TeaPotFPS () is called, the screen shows, and if not, it doesn't? I'd imagine you'd want some global (or at least something visible outside of the switch statement. It can't be allowed to go out of scope after the mouse press code is executed) variable. You might need to post more code.

bool flag = false;

// code

switch(id)
{
    case BUTTON_ID_1:
        if(state == UGP_BUTTON_DOWN)
            flag = true;
        break;

     // more case statements
} // end switch statement

if (flag)
    TeaPotFPS();

Where exactly to put this code would depend on the way your program is structured. I have more experience using GUI's in Java than in C++, so values like UGP_BUTTON_DOWN might mean something to someone else and they'd know exactly where to put this, but I've never seen it before. I wouldn't have commented due to my lack of knowledge on C++ GUI's, but I figured since no one else had in three hours, what the heck... :)

Thanx for your advice! UGP_BUTTON_DOWN isn't anything special, just the name of a case option. Anyway I didn't really need a mouse flag I just had to make another enum with some state options and a class to boot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.