B4J Library [B4A] [XUI] SD: XUI_DragView

Discussion in 'B4J Libraries & Classes' started by Star-Dust, Apr 30, 2018.

  1. Star-Dust

    Star-Dust Expert Licensed User

    This library handles drag and drop of XUI views.
    It is a simple library with few methods but it only serves to drag the space already indicated.
    (required XUI 1.72+)

    Good fun

    SD_XUI_DragView

    Author: Star-Dust
    Version: 0.02
    • DragDropView
      • Events:
        • PlacedCoordinate (DragView As B4XView)
        • PlacedView (DragView As B4XView, PlaceView As B4XView)
      • Fields:
        • OverPlaceMoreView As Boolean
      • Functions:
        • AddDragView (View As B4XView, AddAlsoPlaceCoordinate As Boolean) As DragDropView
          View is mobible View (Label,Panel ecc..)
          AddAlsoPlaceCoordinate (boolean) Add Initial View Coordinate to AddPlaceCoordinate
        • AddPlaceCoordinate (Left As Int, Top As Int, Width As Int, Height As Int) As DragDropView
        • AddPlaceView (View As B4XView) As DragDropView
        • Class_Globals As String
        • ClearDrag As String
        • ClearPlaceCoordinate As String
        • ClearPlaceView As String
        • Initialize (mCallBack As Object, mEventName As String) As String
          Initializes the object. You can add parameters to this method if needed.
        • IsInitialized As Boolean
          Verifica se l'oggetto sia stato inizializzato.
    video1.gif
     

    Attached Files:

    Last edited: Jul 17, 2018
  2. Star-Dust

    Star-Dust Expert Licensed User

    Code:
    Sub Globals
        
    Dim DD As DragDropView
        
        
    Private PanelBase As Panel
        
    Private Label1 As Label
        
    Private Label2 As Label
        
    Private Label3 As Label
        
    Private Label4 As Label
        
    Private Label5 As Label
        
    Private Label6 As Label
        
        
    Private Place1 As Label
        
    Private Place2 As Label
        
    Private Place3 As Label
        
    Private Place4 As Label
        
    Private Place5 As Label
        
    Private Place6 As Label
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.LoadLayout("main")

        DD.Initialize(Me,
    "DD")
        DD.AddDragView(Label1,
    False).AddDragView(Label2,False).AddDragView(Label3,False).AddDragView(Label4,False).AddDragView(Label5,False).AddDragView(Label6,False)
        DD.AddPlaceView(Place1).AddPlaceView(Place2).AddPlaceView(Place3).AddPlaceView(Place4).AddPlaceView(Place5).AddPlaceView(Place6)
    End Sub

    Sub DD_Placed(DragView As View, PlaceView As View)
        
    Log(DragView.Tag & " - " & PlaceView.Tag)
    End Sub
     
  3. Star-Dust

    Star-Dust Expert Licensed User

    ------------ B4A ----------------
    video3.gif
    --------------- B4J ---------------
    ezgif.com-video-to-gif.gif
     
    Last edited: Jun 27, 2018
  4. Star-Dust

    Star-Dust Expert Licensed User

  5. sz4t4n

    sz4t4n Member Licensed User

    Hi

    one question -> how to avoid disappearing view after clicking on it?

    video2.gif
     
  6. Star-Dust

    Star-Dust Expert Licensed User

    I do not know what happens in your case, but it does not happen.
    ezgif.com-video-to-gif.gif
    give me some more information
     
  7. sz4t4n

    sz4t4n Member Licensed User

    But if You click on the label (just click not drag) nothing happens? In my case view (which is dragable) just dissapear after mouse click. I used your sample.
     
  8. Star-Dust

    Star-Dust Expert Licensed User

    Ok, I'll see you in the afternoon and I'll release an update
     
  9. Star-Dust

    Star-Dust Expert Licensed User

    Update to rel. 0.02 (fix Bugs)
     
    sz4t4n likes this.
  10. sz4t4n

    sz4t4n Member Licensed User

    thanks. Work great :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice