in reply to Re^3: WxPerl and drag and dropping files
in thread WxPerl and drag and dropping files

Yeah, that is the same question, see Re^4: WxPerl and drag and dropping files and see open ... do you have a file named the contents of "@_"?

  • Comment on Re^4: WxPerl and drag and dropping files

Replies are listed 'Best First'.
Re^5: WxPerl and drag and dropping files
by james28909 (Deacon) on Jun 20, 2014 at 07:24 UTC
    the contents of "@_" are "Wx::DropFilesEvent=SCALAR(0x3131024)" and i do not have a file named that.
    and actually now that you mentioned that, i remember using some code from wxDND demo modules that would list the file path of the dropped file in a list box. Let me see if i can make something happen with that. i really hope i can figure this out :l

      Hmm, read Re^4: WxPerl and drag and dropping files, call the GetFiles method on the wxDropFilesEvent, get a list of paths ...

      You have objects, call methods on objects, all GUI toolkits everywhere are about "object" on which you call methods, like wxDropFilesEvent...

        here you go, a working drag and drop implementation. thank you very much for your dedicated patience with me mr monk :) i can finally finish this little tool...
        $frame->DragAcceptFiles(1); EVT_DROP_FILES( $frame, \&ondrop ); sub ondrop { my ($self, $this) = @_; Wx::DropFilesEvent::GetFiles($this); our $dropfile = $this->GetFiles(); extract($dropfile); # or i can assign a button to +do the subroutine :) #print "$dropfile"; <----prints the filepath/name }
        once again thank you very much anonymous monk. Also, do you see anything wrong with using the our statement here? is there a better way of doing it?

        See, the contents of the file will always be the same, but the filenames are usually different because of the methods used to obtain this data. and the reason i needed it to do drag and drop was because staticallly setting a filename in the open statement wouldnt have worked to well. i would have had to rename the file to that statically assigned filename for it to work. but now it works great so far :)

        But dont get to comfortable because i will probably have more questions lol