Android Question Drag & Drop

tufanv

Expert
Licensed User
Longtime User
Hello

Is it possible to drag a value from textbox1 to textbox2 with or without a visual drag effect ?

TY
 

DonManfred

Expert
Licensed User
Longtime User
Not that i know of
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Yes if you have to create a class on purpose that does it.
It would not be too complicated
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The drop part might be difficult.

Now I have no time (but I would like to try :D)... but I'm sure that @Star-Dust is trying right now :D
No, I've had enough of drags, which only like me and tufanv :p
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
First method
(You click on the gray border to drag)
ezgif.com-video-to-gif.gif


B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    EditText1.Color=Colors.White
    EditText2.Color=Colors.White
    EditText3.Color=Colors.LightGray
  
    TT.Initialize(EditText1,Colors.Gray,Colors.Black)
End Sub
 

Attachments

  • tufanv_EditText1.zip
    10 KB · Views: 392
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Second method: One click to change the text, a DoubleClick to select a word, Long click to drag.
ezgif.com-video-to-gif.gif

I think you can do it, study it and you will succeed.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    EditText1.Color=Colors.White
    EditText2.Color=Colors.White
    EditText3.Color=Colors.LightGray
 
    TT.Initialize(EditText1,Colors.Gray,Colors.Black)
End Sub
 

Attachments

  • tufanv_EditText2.zip
    10.5 KB · Views: 362
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Third method:

video3.gif


B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim TT As tufanvtext
  
    Private EditText1 As EditText
    Private EditText2 As EditText
    Private EditText3 As EditText
    Private EditText4 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    EditText1.Color=Colors.White
    EditText2.Color=Colors.White
    EditText3.Color=Colors.LightGray
  
    TT.Initialize(EditText1,Colors.Gray,Colors.Black)
End Sub
 

Attachments

  • tufanv_EditText3.zip
    10 KB · Views: 410
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Nobody who asked me how he did it :p
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Now I'm offended I will not reveal it anymore :p
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
But did you publish something (library) about it?
No, I did not think I had to make a floating Copy & Past for EditText. As erel says correctly, you create a conflict with the Select of the clipboard
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Today I am good at heart and I have attached the sources to the posts with examples.
But I suggest the third method is more stable, I use less code and the concept is simpler.
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
You changed your post; it was "Today I feel good...", so...
Yes, as you know that Google Translate translates very badly, sometimes I agree with errors for the little bit of English that I know and correct.

Unfortunately I do not always notice and misunderstandings happen, not keeping in mind that there may also be typos that are always translated in a fanciful way by Google
 
Last edited:
Upvote 0
Top