iOS Question SetLayoutAnimation behaviour

semar

Active Member
Licensed User
Longtime User
Hello,
the animation of a Button
B4X:
btn_anim_test.SetLayoutAnimated( 2000,1,10,190,150,25)
works fine when the above code is executed inside the Click event of the button, and the button is pressed.

However, if I try to animate the button programmatically - without clicking on it - it does not work as expected.

In fact the button moves itself but it does not reach the coordinates set in the SetLayoutAnimated command, rather it reaches its default Left and Top properties which was set on the designer, and
the Width and Heigth properties are not affected either.

Is this the normal behaviour of SetLayoutAnimated ? Is there a way to move the button programmatically to an arbitrary position without having to click on it ?

[EDIT]
The above code works also fine when executed inside a Click event of another Button. But it does not work, for example, inside a timer_tick event wich is fired after loading the layout containing the Button to animate.
[/EDIT]

Regards,
Sergio
 
Last edited:

semar

Active Member
Licensed User
Longtime User
My guess is that the page is resized during the animation and the button is repositioned based on the layout file. You can uncheck the Handle Resize Events option in the layout file.
That did the trick, many thanks !
 
Upvote 0
Top