Jump to content

Drag&Drop


Recommended Posts

How can I do a drag and drop between to List Controls?

My code is

#include <GUIConstants.au3>
#include <GuiList.au3>

$Form1 = GUICreate("Panel de Control", 427, 455,-1,-1,-1,$WS_EX_ACCEPTFILES)
$Group1 = GUICtrlCreateGroup("Pacientes", 16, 8, 401, 313)

GUICtrlCreateLabel("En espera", 80, 17, 52, 17)
$ListPE = GUICtrlCreateList("", 32, 32, 145, 253)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)

GUICtrlCreateLabel("Atendidos", 236, 17, 51, 17)
$ListPA = GUICtrlCreateList("", 112, 360, 193, 58)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)

GUICtrlCreateLabel("Nombre del paciente:", 32, 290, 105, 17)
$InNombreP = GUICtrlCreateInput("", 136, 288, 169, 21)
$BtIngresar = GUICtrlCreateButton("Ingresar", 308, 286, 49, 25)
$Radio1 = GUICtrlCreateRadio("Chèque", 346, 23, 65, 17)
$Radio2 = GUICtrlCreateRadio("CB", 346, 39, 57, 17)
$Radio3 = GUICtrlCreateRadio("Espèces", 346, 55, 65, 17)
$Checkbox1 = GUICtrlCreateCheckbox("MNO", 347, 76, 54, 14)
$Button2 = GUICtrlCreateButton("Validar", 347, 94, 49, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Doctores", 16, 328, 401, 121)
GUICtrlCreateLabel("Doctores", 185, 341, 47, 17)
GUICtrlCreateLabel("Doctor :", 84, 419, 42, 17)
$Input2 = GUICtrlCreateInput("", 128, 416, 169, 21)
$Button1 = GUICtrlCreateButton("Agregar", 307, 415, 59, 25)
$List2 = GUICtrlCreateList("", 184, 32, 153, 253)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $BtIngresar
        $ret = _GUICtrlListAddItem ($ListPE , GUICtrlRead($InNombreP))
    Case Else
        ConsoleWrite($msg)
    EndSelect
WEnd
Exit
Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <GuiListView.au3>


$Form1 = GUICreate("Panel de Control", 427, 455, -1, -1, -1, $WS_EX_ACCEPTFILES)
$Group1 = GUICtrlCreateGroup("Pacientes", 16, 8, 401, 313, -1, $WS_EX_TRANSPARENT)

GUICtrlCreateLabel("En espera", 80, 17, 52, 17)
$ListPE = GUICtrlCreateListView("En espera", 32, 32, 145, 253, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOCOLUMNHEADER))
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUICtrlCreateLabel("Atendidos", 236, 17, 51, 17)
$ListPA = GUICtrlCreateListView("Atendidos", 184, 32, 153, 253, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOCOLUMNHEADER))
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUICtrlCreateLabel("Nombre del paciente:", 32, 290, 105, 17)
$InNombreP = GUICtrlCreateInput("", 136, 288, 169, 21)
$BtIngresar = GUICtrlCreateButton("Ingresar", 308, 286, 49, 25)
$Radio1 = GUICtrlCreateRadio("Chèque", 346, 23, 65, 17)
$Radio2 = GUICtrlCreateRadio("CB", 346, 39, 57, 17)
$Radio3 = GUICtrlCreateRadio("Espèces", 346, 55, 65, 17)
$Checkbox1 = GUICtrlCreateCheckbox("MNO", 347, 76, 54, 14)
$Button2 = GUICtrlCreateButton("Validar", 347, 94, 49, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Doctores", 16, 328, 401, 121)
GUICtrlCreateLabel("Doctores", 185, 341, 47, 17)
GUICtrlCreateLabel("Doctor :", 84, 419, 42, 17)
$Input2 = GUICtrlCreateInput("", 128, 416, 169, 21)
$Button1 = GUICtrlCreateButton("Agregar", 307, 415, 59, 25)
$List2 = GUICtrlCreateList("", 112, 360, 193, 58)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $GUI_EVENT_DROPPED
         _GUICtrlListViewInsertItem (@GUI_DropId, -1, _GUICtrlListViewGetItemText (@GUI_DragId))
         
         
      Case $msg = $BtIngresar
         GUICtrlCreateListViewItem(GUICtrlRead($InNombreP), $ListPE)
         
   EndSelect
WEnd
Exit

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...