Hi.
I have a Designer script that positions some Buttons with "Relative" positioning and I want to animate them using the Animation library. For this I require the .Top and .Left positions as I want to animate them horizontally and not from the top left of the screen. Note: .Left position isn't really required as I will use 0 but the principle holds. The Designer script code for the positioning of the Imageviews:
However when I run this code to get the co-ordinates I only get the .Top from the first Button and not the other Buttons.
In the log I get returned (see attached image).
I believe it is some kind of timing issue as the Buttons draw correctly (see attachment) on screen in their relative positions (as per Designer script). I just can't get access to the positions myself.
I believe a Callback is required (read on a java forum)? But I don't know what to do and I have no java knowledge. See attachment for Java answer to my problem.
I have a Designer script that positions some Buttons with "Relative" positioning and I want to animate them using the Animation library. For this I require the .Top and .Left positions as I want to animate them horizontally and not from the top left of the screen. Note: .Left position isn't really required as I will use 0 but the principle holds. The Designer script code for the positioning of the Imageviews:
B4X:
IconButton_A.VerticalCenter=40%y
IconButton_B.Top=IconButton_A.Bottom + 25dip
IconButton_C.Top=IconButton_B.Bottom + 25dip
IconButton_D.Top=IconButton_C.Bottom + 25dip
However when I run this code to get the co-ordinates I only get the .Top from the first Button and not the other Buttons.
B4X:
'Refresh UI so can calculate location of Buttons
IconButton_A.Invalidate
IconButton_B.Invalidate
IconButton_C.Invalidate
IconButton_D.Invalidate
I=0
For I= 0 To 3
LogColor("Sub: SecondScreen.Activity_Create(). IconButtonCoordinates Array - Button:= " & Starter.IconButtonCoordinates(I,0),Colors.Blue)
LogColor("Sub: SecondScreen.Activity_Create(). IconButtonCoordinates Array - Top:= " & Starter.IconButtonCoordinates(I,1),Colors.DarkGray)
LogColor("Sub: SecondScreen.Activity_Create(). IconButtonCoordinates Array - Left:= " & Starter.IconButtonCoordinates(I,2),Colors.Magenta)
Next
In the log I get returned (see attached image).
I believe it is some kind of timing issue as the Buttons draw correctly (see attachment) on screen in their relative positions (as per Designer script). I just can't get access to the positions myself.
I believe a Callback is required (read on a java forum)? But I don't know what to do and I have no java knowledge. See attachment for Java answer to my problem.
Attachments
Last edited: