Jump to content

Help required while dragging and Dropping a object


anks
 Share

Recommended Posts

Hi All,

I am trying to Drag and Drop a object . I have used GUISetOnEvent() , but it doesnot work

Here is the following code snippet:

; $BoolCPoint = the handle for my object which needs to be dragged.

; dragEvent = User defined Function.

$drgrturn = GUISetOnEvent(@GUI_DRAGID, "dragEvent", $BoolCPoint)

Func dragEvent()

$drgrturn = GUISetOnEvent(@GUI_DROPID, "Drop", $BoolCPoint)

msgbox( 0 ,"", $drgrturn)

EndFunc

Func Drop()

;Here the object needs to be dropped.

ConsoleWrite('@GUI_DropID: ' & @GUI_DropID & ' @GUI_DragFile: ' & @GUI_DragFile & ' @GUI_DragID: ' & @GUI_DragID & @CRLF)

EndFunc

NOTE: I have MouseClickDrag() function but this function drag and drops the object using coordinates, which i am not expecting.

Please help me.

Thanks

Link to comment
Share on other sites

Hi All,

I am trying to Drag and Drop a object . I have used GUISetOnEvent() , but it doesnot work

Here is the following code snippet:

; $BoolCPoint = the handle for my object which needs to be dragged.

; dragEvent = User defined Function.

$drgrturn = GUISetOnEvent(@GUI_DRAGID, "dragEvent", $BoolCPoint)

Func dragEvent()

$drgrturn = GUISetOnEvent(@GUI_DROPID, "Drop", $BoolCPoint)

msgbox( 0 ,"", $drgrturn)

EndFunc

Func Drop()

;Here the object needs to be dropped.

ConsoleWrite('@GUI_DropID: ' & @GUI_DropID & ' @GUI_DragFile: ' & @GUI_DragFile & ' @GUI_DragID: ' & @GUI_DragID & @CRLF)

EndFunc

NOTE: I have MouseClickDrag() function but this function drag and drops the object using coordinates, which i am not expecting.

Please help me.

Thanks

The last paremetr for GuiSetOnEvent is the handle for the window where the object will be dropped.

The event you need to register is $GUI_EVENT_DROPPED.

GUISetOnEvent($GUI_EVENT_DROPPED, "Drop")


Func Drop()
 ;Here the object needs to be dropped.
 ConsoleWrite('@GUI_DropID: ' & @GUI_DropID & ' @GUI_DragFile: ' & @GUI_DragFile & ' @GUI_DragID: ' & @GUI_DragID & @CRLF)
EndFunc

See GuiCreate in the help for $WS_ACCEPTFILES style and the $GUI_DROPACCEPTED state for controls.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The last paremetr for GuiSetOnEvent is the handle for the window where the object will be dropped.

The event you need to register is $GUI_EVENT_DROPPED.

GUISetOnEvent($GUI_EVENT_DROPPED, "Drop")


Func Drop()
 ;Here the object needs to be dropped.
 ConsoleWrite('@GUI_DropID: ' & @GUI_DropID & ' @GUI_DragFile: ' & @GUI_DragFile & ' @GUI_DragID: ' & @GUI_DragID & @CRLF)
EndFunc

See GuiCreate in the help for $WS_ACCEPTFILES style and the $GUI_DROPACCEPTED state for controls.

Yaah i am using the following snippet of code but it is of no use

$drgdrprtrn = GUISetOnEvent($GUI_EVENT_DROPPED, "Drop", "CWireSheetEditor") ; CWireSheetEditor: It is the handle where the object needs to be dropped.
;~ msgbox( 0 ,"", $drgdrprtrn)
Link to comment
Share on other sites

The last paremetr for GuiSetOnEvent is the handle for the window where the object will be dropped.

The event you need to register is $GUI_EVENT_DROPPED.

GUISetOnEvent($GUI_EVENT_DROPPED, "Drop")


Func Drop()
 ;Here the object needs to be dropped.
 ConsoleWrite('@GUI_DropID: ' & @GUI_DropID & ' @GUI_DragFile: ' & @GUI_DragFile & ' @GUI_DragID: ' & @GUI_DragID & @CRLF)
EndFunc

See GuiCreate in the help for $WS_ACCEPTFILES style and the $GUI_DROPACCEPTED state for controls.

Yaah i am using the following snippet of code but it is of no use

; CWireSheetEditor: It is the handle where the object needs to be dropped.
$drgdrprtrn = GUISetOnEvent($GUI_EVENT_DROPPED, "Drop", "CWireSheetEditor")
msgbox( 0 ,"", $drgdrprtrn)

Func Drop()

 ;Here the object needs to be dropped.
 GUICtrlSetState("CWireSheetEditor", $GUI_DROPACCEPTED)
 ConsoleWrite('@GUI_DropID: ' & @GUI_DropID & ' @GUI_DragFile: ' & @GUI_DragFile & ' @GUI_DragID: ' & @GUI_DragID & @CRLF)
EndFunc

The above code still doesn't work.

I am trying to drag a object created in C# .Net and drop it in the same window. SO i think $WS_EX_ACCEPTFILES, will be of no use as it is used for the GUI created in AUTOIT.

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...