Android Question click event for button moved in designer script does not reflect new location

Louis Ashford

New Member
Licensed User
Longtime User
Hello,
I have found a problem with the designer scripts that I don't quite understand. To simplify the problem I can create a screen with two buttons. One named Left button and the other Right button for example. I place them left on left and right on right. next I open a designer script and move the left to where the right one was and the right to where the left was. This is because in a particular program I needed to swap two buttons but in another configuration wanted them as they were.
The problem is that when the program runs the buttons swap but the OnClick event for the Left button now fires the event for the Right one and vise versa. It seems that the buttons were moved by the designer script but the click events are still being directed the original buttons that was in each location when the button events were created. (before creating the designer script)
Is this the expected behavior?
Thanks,
Louis
 

Attachments

  • B4A Button swap test.zip
    377.4 KB · Views: 161

Louis Ashford

New Member
Licensed User
Longtime User
The way you have your script done is overlapping the buttons, use this code instead:
B4X:
LeftButton.Left = (100%x - LeftButton.Width * 2) / 2
RightBurtton.Left = LeftButton.Right

Thank you for your response. I didn't think they were overlapping but I will check that. Thanks again.
Louis
 
Upvote 0
Top