Android Question Remove DraggableViews

ALBRECHT

Active Member
Licensed User
Hello,

Im looking for swaping (by code) the x,y coordonate of some 2 draggableview which was initialy created with the loop below :

B4X:
nbbut = 4
    For i=0 To nbbut - 1
        btns(i).Initialize("button")
        btns(i).Text = "Button:" & i
        btns(i).TextColor = Colors.Black
        btns(i).Color = coul(i)
        btns(i).Tag = i
        panx(i) = 50dip + ((wb + 10)*i)
        pany(i) = 130dip
        panw(i) = wb
        panh(i) = hb

        panel0.AddView(btns(i), panx(i), pany(i), panw(i), panh(i))
        dv(i).Initialize(Activity, btns(i), Colors.Transparent, panx(i), pany(i), i)

    Next

for example to swap the positions of 2 and 3 view, i thought first to swap the 2 data : panx(i), pany(i)
and next remove and re create the 2 views with something like :

B4X:
'remove
btns(i).removeviews '**********
dv(i).remove '******************

'create again
panel0.AddView(btns(i), panx(i), pany(i), panw(i), panh(i))
dv(i).Initialize(Activity, btns(i), Colors.Transparent, panx(i), pany(i), i)
...

if its the good manner, how to remove button and the dv associated before to create it again?

Regards
Take care ?
Michel
 

ALBRECHT

Active Member
Licensed User
please :

its ok for swapping the button :
B4X:
'front move to behind position
btns(infront).SetLayoutAnimated(1000, pany(behind), panx(behind), panw(behind),panh(behind))

but dv(i) which is the associated DraggableView dont accept the SetLayoutAnimated method ?

- what do you mean by "make it public" ?
 
Last edited:
Upvote 0

ALBRECHT

Active Member
Licensed User
sorry the swaping of 2 Draggable Buttons dont works on my side :
so, is there a special place on the forum where i could send my B4A files and request corrections ?
Regards
Take care ?
Michel
 
Upvote 0

ALBRECHT

Active Member
Licensed User
Ok , it works like you said:

- add to the class :
B4X:
Sub MoveView(Dur As Int, Posx As Int, Posy As Int, wi As Int, he As Int)
    innerView.SetLayoutAnimated(Dur, Posx, Posy, wi, he)
    panel1.SetLayoutAnimated(Dur, Posx, Posy, wi, he)
End Sub

Thanks
 
Upvote 0
Top