I'am a little bit despareted. I like to drag some panels or imageviews on a playfield. Works fine but how can I bring the active panel or imageview to front or at a higher elevation and at which location ideally in the code? Maybe my declaration of the gestureDetector is wrong, you see I'm not a very experienced user. Therefore a second question. I like these views also to rotate (by 90° steps, maybe enough but a smooth animation will be also welcome) and flip (in two different gesturedetector subs). As I read in the graphics booklet an imageview offers naturaly both methods. On the other hand it should be no problem to get the bitmap of a panel. So what do you suggest I should prefer for my belongings, panels or imageviews? Excuse my bad english and please answer in relative short sentences, thank you! German answers are also welcome!
the shortened but full working code is also attached as zip.
EdiT: the views are located on another panel. Don't know if this is important.
EdiT: the views are located on another panel. Don't know if this is important.
3 snippets: GD declarations and GD onDrag Sub:
Dim GD0 As GestureDetector
Dim GD1 As GestureDetector
Dim GD2 As GestureDetector
Dim GD3 As GestureDetector
Dim GD(4) As GestureDetector
...
GD=Array As GestureDetector(GD0, GD1, GD2, GD3)
piece=Array As Panel(pcs0, pcs1, pcs2, pcs3)
Dim i As Int
For i= 0 To 3
GD(i).SetOnGestureListener(piece(i), "Gesture")
Next
....
Sub Gesture_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object)
Dim i As Panel=Sender
Dim j As Int
j=i.Tag
Log("no " & " " & j)
'piece(j).Elevation=5dip 'no crash , but also no reaction
'piece(i).bringtofront crashes as well as piece(j).bringtofront
i.left = Max(9dip, Min(i.Left + deltaX, bg.width -i.Width-9dip))
i.top = Max(9dip, Min(i.Top + deltaY, bg.height-i.height))
If DipToPixels(i.top) < 340 Then
i.SetLayoutAnimated(0,i.left, i.top, states.Get("width" & j), states.Get("height" & j))
Else
i.SetLayoutAnimated(0,i.left, i.top, states.Get("width" & j)*0.6, states.Get("height" & j)*0.6)
End If
End Sub