cancel
Showing results for 
Search instead for 
Did you mean: 

handleTickEvent enable and disable

Ezgi
Senior

I have an animation that the image is getting bigger by the tick. But I want that when it gets a "true" once from model , the animation gets started and continue until it gets a "false".

void IgnitionOnDemoScreenView::ShowUpLogo(bool Logo, bool Fade)
{
	if (Logo == true) {
		Tick++;
		if (Tick % 2 == 0) {
			if (LogoImage.getWidth() < 240 && LogoImage.getHeight() < 320) {
				LogoImage.setPosition(LogoImage.getX() - 3, LogoImage.getY() - 4, LogoImage.getWidth() + 6, LogoImage.getHeight() + 8);
				LogoImage.invalidate();
			}
		}
	}
 
	if (Fade == true) {
 
		FadeLogo();
	}
 
}

I know this one is wrong, but I can't handle it. Can I enable and disable the handleTickEvent? Could you help me?

2 REPLIES 2
BParh.1
Senior III

where do you put this IgnitionOnDemoScreenView::ShowUpLogo() and where did you call it?

Romain DIELEMAN
ST Employee

Hi,

You could do it directly within the handleTickEvent() function, like this for example:

void IgnitionOnDemoScreenView::handleTickEvent()
{
	if (Logo == true) {
		tickCounter++;
		if (tickCounter == 2)
		 {
                	tickCounter = 0;
			if ( LogoImage.getWidth() < 240 && LogoImage.getHeight() < 320 ) 
                        {
				LogoImage.setPosition(LogoImage.getX() - 3, LogoImage.getY() - 4, LogoImage.getWidth() + 6, LogoImage.getHeight() + 8);
				LogoImage.invalidate();
			}
		}
	}
 
	if (Fade == true) {
 
		FadeLogo();
	}
 
}

I believe that would be easier :grinning_face_with_sweat:

/Romain