Page 1 sur 1
[R] Drop et drag d'un "label" dans un "input" ??
Posté : ven. 06 févr. 2015 19:47
par tomasomalley
Bonjour les amis ....
la question est à peu près dans le titre, mais je m'explique :
Je viens de créer un petit script et dans ma GUI j'ai plusieurs "labels" qui contiennent des données et j'aimerai pourvoir dragguer et dropper (excusez moi pour ces termes) le contenu d'un de ces labels dans une "input"
attention je ne parle pas de drag and drop un fichier je parle bien du contenu d'un "label" vers un "input"
bon c'est vrai que le copier coller fonctionne bien aussi mais c'est juste pour rendre mon outil plus sexi ....
merci à vous, bonne soirée
Re: [..]Drop et drag d'un "label" dans un "input" ??
Posté : ven. 06 févr. 2015 19:55
par tomasomalley
C'est encore moi, voici une petite gui de test pour les amateurs ...
donc, but du jeu, draguer et droper le "test" dans le input qui est vide
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
Example()
Func Example()
; Create a GUI with various controls.
Local $hGUI = GUICreate("Example", 220, 100, -1, -1)
local $adropper = GUICtrlCreateLabel("test", 10, 10, 100, 20)
Local $receptacle = GUICtrlCreateInput("", 10, 40, 100, 20)
Local $idOK = GUICtrlCreateButton("OK", 10, 70, 85, 25)
; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idOK
ExitLoop
EndSwitch
WEnd
; Delete the previous GUI and all controls.
GUIDelete($hGUI)
EndFunc ;==>Example
Re: [..] Drop et drag d'un "label" dans un "input" ??
Posté : ven. 06 févr. 2015 21:45
par ZDS
Et voila ! ^^
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
Example()
Func Example()
; Create a GUI with various controls.
Local $hGUI = GUICreate("Example", 220, 100, -1, -1)
local $adropper = GUICtrlCreateLabel("test", 10, 10, 100, 20)
Local $receptacle = GUICtrlCreateInput("", 10, 40, 100, 20)
Local $idOK = GUICtrlCreateButton("OK", 10, 70, 85, 25)
; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)
; Loop until the user exits.
Local $dragndrop = 0
While 1
Local $msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE, $idOK
ExitLoop
EndSwitch
Local $info = GUIGetCursorInfo($hGUI)
If @error = 0 Then
If Not $dragndrop And $info[2] Then ; Drag
$dragndrop = -1
Select
Case $info[4] = $adropper
GUICtrlSetColor($adropper, 0x0000FF)
$dragndrop = $adropper
Case Else
; Rien
EndSelect
EndIf
If $dragndrop And Not $info[2] Then ; Drop
GUICtrlSetColor($adropper, 0x000000)
Select
Case $info[4] = $receptacle And $dragndrop = $adropper
GUICtrlSetData($receptacle, GUICtrlRead($adropper))
Case Else
; Rien
EndSelect
$dragndrop = 0
EndIf
EndIf
WEnd
; Delete the previous GUI and all controls.
GUIDelete($hGUI)
EndFunc ;==>Example
A bientôt !
Re: [..] Drop et drag d'un "label" dans un "input" ??
Posté : ven. 06 févr. 2015 22:16
par tomasomalley
trop fort je t'adorrrrrre ....
bonne soirée
Re: [R] Drop et drag d'un "label" dans un "input" ??
Posté : ven. 06 févr. 2015 22:17
par tomasomalley
ah oui et je ferme
Re: [..] Drop et drag d'un "label" dans un "input" ??
Posté : ven. 06 févr. 2015 22:29
par ZDS
Pour le [R], c'est en cliquant sur le bouton "éditer" de ton premier message ^^ Bonne soirée !
Re: [..] Drop et drag d'un "label" dans un "input" ??
Posté : sam. 07 févr. 2015 12:38
par mikell
Je déconseille l'utilisation de "$idOK" en dehors d'une fonction (déclaration strictement locale)