[Gambas-user] Listview and drag and drop

Gianluigi gradobag at gradobag.it
Thu Feb 23 17:45:01 CET 2023


Il 23/02/23 15:18, Fabien TONIUTTI ha scritto:
> Hi,
>
> I have on one form :
>
> one listview with 5 rows.
>
> one label with text inside.
>
>
> I want by drag text from label to listview and insert it between line 
> 3 and 4 of my listview by drop event.
>
> How could i process?
>
> Thanks for your answer.
>
> spheris
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Hi Spheris,

Since no one is responding, I'll put my two cents in:

'------------------------
' Gambas class file

Private $iIndex As Integer

Public Sub Form_Open()

   Label1.Text = "TEST_TEXT"
   Label1.Drop = True
   ListBox1.Drop = True
   ListBox1[3].Selected = True

End

Public Sub Label1_MouseDrag()

   If Mouse.Left Then
     $iIndex = ListBox1.Find(ListBox1.Current.Text)
     Label1.Drag(Label1.Text, "text/html")
   Endif

End

Public Sub ListBox1_Drop()

   ListBox1.Add(Drag.Data, $iIndex)

End
'-------------------------------

If you wish to change position act on the arrows before dragging

Regards

Gianluigi



More information about the User mailing list