Skip to main content
Ezgi
Associate III
May 17, 2021
Question

handleTickEvent enable and disable

  • May 17, 2021
  • 2 replies
  • 806 views

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?

This topic has been closed for replies.

2 replies

BParh.1
Senior III
May 17, 2021

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

Romain DIELEMAN
ST Employee
May 17, 2021

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