cancel
Showing results for 
Search instead for 
Did you mean: 

Even though gfx::Box position set outside of a screen, it is still visible

ferro
Senior III

Hi,

Attached project starts with this screen:

ferro_1-1732723422268.png

 

When the white Box is moved to the left - with pressing 'a' key, it should completely go off the screen. However, one pixel thick line is always visible.

box1.setX       ( box1.getX () - 1 );
box1.invalidate ();

ferro_0-1732723227217.png

Why ?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
LouisB
ST Employee

Hello @ferro,

 

Try to put an invalidate before "box1.setX ( box1.getX () - 1 );".

With only one invalidate at the end, it will only invalidate the area in the new position, so the line outside will not be refreshed. Also if you move your box in the screen you may have a (w+1) * h box due to that.

Best regards,

Louis BOUDO
ST Software Developer | TouchGFX

View solution in original post

2 REPLIES 2
LouisB
ST Employee

Hello @ferro,

 

Try to put an invalidate before "box1.setX ( box1.getX () - 1 );".

With only one invalidate at the end, it will only invalidate the area in the new position, so the line outside will not be refreshed. Also if you move your box in the screen you may have a (w+1) * h box due to that.

Best regards,

Louis BOUDO
ST Software Developer | TouchGFX

Thanks @LouisB 

Interesting, in all Gfx examples - i've seen so far - invalidate is placed after all actions on widgets.

So this works as expected now, with a single 'invalidate ()' before:

 

box1.invalidate ();
box1.setX       ( box1.getX () - 1 );

 

 

"With only one invalidate at the end, it will only invalidate the area in the new position, so the line outside will not be refreshed. Also if you move your box in the screen you may have a (w+1) * h box due to that."

Thank you for this, will explore further.