ALBRECHT Active Member Licensed User Apr 14, 2020 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Apr 15, 2020 #2 DraggableView just adds a transparent panel above the view. You need to add the view with SetLayoutAnimated and then do the same to the DraggableView panel (make it public). Upvote 0
DraggableView just adds a transparent panel above the view. You need to add the view with SetLayoutAnimated and then do the same to the DraggableView panel (make it public).
ALBRECHT Active Member Licensed User Apr 15, 2020 #3 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: Apr 15, 2020 Upvote 0
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" ?
Erel B4X founder Staff member Licensed User Longtime User Apr 16, 2020 #4 See the code in that class. It is very simple. You need to make panel1 public and move it. Upvote 0
ALBRECHT Active Member Licensed User Apr 16, 2020 #5 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
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
Erel B4X founder Staff member Licensed User Longtime User Apr 17, 2020 #6 ALBRECHT said: so, is there a special place on the forum where i could send my B4A files and request corrections ? Click to expand... You can post questions in the questions forum. You can also post anything you like in the "job offers" forum. Upvote 0
ALBRECHT said: so, is there a special place on the forum where i could send my B4A files and request corrections ? Click to expand... You can post questions in the questions forum. You can also post anything you like in the "job offers" forum.
ALBRECHT Active Member Licensed User Apr 18, 2020 #7 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
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