Después del ejemplo con las modelos. Decidí en este ejemplo eliminar los botones y usar Drag Drop.
Esta vez son personas importantes del mundo Linux. Aunque he añadido pocas, representan los más
conocidos. Desde luego queda la opción pendiente de añadir manualmente personas.
¿ Así que Drag solo mueve texto e imágenes ?. O puede que una cosa y la otra no a la vez.
En el próximo a ver si lo hago con imágenes y texto, pero usando Drag Drop.
Private vip_linux As New String[]
Public Sub Form_Open()
'Ejemplo de DragDrop con texto
vip_linux = ["Linux Torvalds",
"Richard Stallman",
"Andrew Morton",
"Eric S Raymond",
"Andrew Tridgell",
"Mark Shuttleworth",
"Marc Ewing",
"Miguel de Icaza",
"Michael Widenius",
"Rasmus Lerdof"]
LstBoxOrigen.List = vip_linux
LstBoxOrigen.Sorted = True
LstBoxOrigen.Mode = Select.Multiple
LstBoxDestino.Sorted = True
LstBoxDestino.Mode = Select.Multiple
End
Public Sub btnSalir_Click()
Me.Close
End
Public Sub GrupoListas_MouseDrag()
Dim i As Integer
Dim cad As String
Dim Origen As ListBox
Dim seleccionados As New String[]
Select Case Last.name
Case "LstBoxOrigen"
Origen = LstBoxOrigen
Case "LstBoxDestino"
Origen = LstBoxDestino
End Select
For i = 0 To Origen.Count - 1
If Origen[i].Selected Then
seleccionados.Add(Origen.List[i])
Endif
Next
If Mouse.Left And seleccionados.Count > 0 Then
cad = seleccionados.Join("\n")
Last.Drag(cad)
Drag.Icon = Picture["icon:/copy"]
Endif
End
Public Sub GrupoListas_Drop()
Dim lista As New String[]
Dim elemento As String
Dim Destino As ListBox
Dim Origen As ListBox
If Drag.type = Drag.Text Then
Select Case Last.name
Case "LstBoxOrigen"
Destino = LstBoxOrigen
Origen = LstBoxDestino
Case "LstBoxDestino"
Destino = LstBoxDestino
Origen = LstBoxOrigen
End Select
lista = Split(Drag.Data, "\n")
For Each elemento In lista
Destino.Add(elemento)
Origen.Remove(Origen.Find(elemento))
Next
Endif
End
Public Sub Form_Open()
'Ejemplo de DragDrop con texto
vip_linux = ["Linux Torvalds",
"Richard Stallman",
"Andrew Morton",
"Eric S Raymond",
"Andrew Tridgell",
"Mark Shuttleworth",
"Marc Ewing",
"Miguel de Icaza",
"Michael Widenius",
"Rasmus Lerdof"]
LstBoxOrigen.List = vip_linux
LstBoxOrigen.Sorted = True
LstBoxOrigen.Mode = Select.Multiple
LstBoxDestino.Sorted = True
LstBoxDestino.Mode = Select.Multiple
End
Public Sub btnSalir_Click()
Me.Close
End
Public Sub GrupoListas_MouseDrag()
Dim i As Integer
Dim cad As String
Dim Origen As ListBox
Dim seleccionados As New String[]
Select Case Last.name
Case "LstBoxOrigen"
Origen = LstBoxOrigen
Case "LstBoxDestino"
Origen = LstBoxDestino
End Select
For i = 0 To Origen.Count - 1
If Origen[i].Selected Then
seleccionados.Add(Origen.List[i])
Endif
Next
If Mouse.Left And seleccionados.Count > 0 Then
cad = seleccionados.Join("\n")
Last.Drag(cad)
Drag.Icon = Picture["icon:/copy"]
Endif
End
Public Sub GrupoListas_Drop()
Dim lista As New String[]
Dim elemento As String
Dim Destino As ListBox
Dim Origen As ListBox
If Drag.type = Drag.Text Then
Select Case Last.name
Case "LstBoxOrigen"
Destino = LstBoxOrigen
Origen = LstBoxDestino
Case "LstBoxDestino"
Destino = LstBoxDestino
Origen = LstBoxOrigen
End Select
lista = Split(Drag.Data, "\n")
For Each elemento In lista
Destino.Add(elemento)
Origen.Remove(Origen.Find(elemento))
Next
Endif
End
Ejemplo:
PasarItemDeUnaListaAOtraConDragDrop.zip | ||
Descripción: | Descargar |
|
Nombre del archivo: | PasarItemDeUnaListaAOtraConDragDrop.zip | |
Tamaño: | 15.81 KB | |
Descargado: | 51 veces |
PasarItemDeUnaListaAOtraConDragDrop.zip | ||
Descripción: | Descargar |
|
Nombre del archivo: | PasarItemDeUnaListaAOtraConDragDrop.zip | |
Tamaño: | 15.81 KB | |
Descargado: | 51 veces |
PasarItemDeUnaListaAOtraConDragDrop.zip | ||
Descripción: | Descargar |
|
Nombre del archivo: | PasarItemDeUnaListaAOtraConDragDrop.zip | |
Tamaño: | 15.81 KB | |
Descargado: | 51 veces |