Sign in to follow this  
Followers 0
Ronicus

Drag And Drop Issues

3 posts in this topic

I am having issues getting this to call the feed() function when I drop a file into the gui The picture is of my dog does anyone know what im doing wrong I did this in isn studio and put it on scite to post here

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Global $Mindy_Lou = GUICreate("Mindy Lou", 350, 350, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00FFFF, $Mindy_Lou)
GUISetOnEvent($GUI_EVENT_DROPPED, "Feed", $Mindy_Lou)
Global $mlpic = GUICtrlCreatePic("C:\Users\User\Pictures\15823324_927563974010116_3800387137275086126_n.jpg", 20, 20, 311, 171, -1, $WS_EX_ACCEPTFILES)
GUICtrlSetState(-1, BitOR($GUI_SHOW, $GUI_ENABLE, $GUI_DROPACCEPTED))
GUICtrlCreateButton("Feed ME !", 120, 210, 100, 30, -1, -1)
GUICtrlSetOnEvent(-1, "Nom")
Global $ML = GUICtrlCreateLabel("Mindy Lou", 30, 160, 135, 15, -1, -1)
GUICtrlSetOnEvent(-1, "Nom")
GUICtrlSetFont(-1, 10, 795, 0, "Segoe Script")
GUICtrlSetColor(-1, "0x00FFFF")
GUICtrlSetBkColor(-1, "-2")
GUICtrlCreateButton("Exit", 120, 240, 100, 30, -1, -1)
GUICtrlSetOnEvent(-1, "onExit")
GUISetState(@SW_SHOW, $Mindy_Lou)

OnLoad()



Func OnLoad()
    While 1
        Opt("GUIOnEventMode", 1)

        GUISetState(@SW_SHOW, $Mindy_Lou)

        GUISetOnEvent($GUI_EVENT_DROPPED, "Feed")
        GUISetOnEvent($GUI_EVENT_MINIMIZE, "Feed")




    WEnd
EndFunc   ;==>OnLoad

Func Feed()
    MsgBox($MB_SYSTEMMODAL, "", "Nom Nom Gimme More !!!!!!")



EndFunc   ;==>Feed

Func Nom()

    Local $ML2
    $ML2 = GUICtrlRead($ML)
    GUICtrlSetData($ML, "NOM NOM NOM!!!")
    If $ML2 = "NOM NOM NOM!!!" Then
        GUICtrlSetData($ML, "Mindy Lou")
    EndIf


EndFunc   ;==>Nom
Func onExit()

    Exit

EndFunc   ;==>onExit

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Looking at an old program of mine where I drop files on a Listbox, the control does not need to have $WS_EX_ACCEPTFILES set.  Only the Gui, if you are dropping the files from Explorer the parent window handles it.  The control you want it dropped on only needs to set $GUI_DROPACCEPTED in the call to GuiCtrlSetState.

At least that works for me dropping a list of filenames from explorer.  I haven't done drag and drop to get the images.

Edited by MilesAhead

Share this post


Link to post
Share on other sites

Even with that changed I cant seem to get it to work :(

Share this post


Link to post
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
Sign in to follow this  
Followers 0