Hi James,
I don't use it myself, but there is an example in Wx::Demo. The
relevent code looks like this:
# files drop target
Wx::StaticText->new( $this, -1, 'Drop files below', [ 10, 140 ] );
my $dropfiles = Wx::ListBox->new( $this, -1, [ 10, 170 ], [ 150, 50 ] );
$dropfiles->SetDropTarget
( Wx::DemoModules::wxDND::FilesDropTarget->new( $dropfiles ) );
(I don't know what Wx::DemoModules::wxDND::FilesDropTarget does.)
There is also some doc about wxFileDropTarget::OnDropFiles here:
http://docs.wxwidgets.org/trunk/classwx_file_drop_target.html#a17b5db1464b525ffe1974af64b034f6d
which might help.
Let me know if it helps. If not I might have another look over the weekend.
Regards
Steve
On 13/06/14 07:40, James Howell wrote:
if it helps any i just want to drag and drop a file onto the gui
anywhere and send it directly to a subroutine without using any
buttons or any other widget
On Fri, Jun 13, 2014 at 2:32 AM, James Howell <james28...@gmail.com
<mailto:james28...@gmail.com>> wrote:
i use the following code to allow dragging and dropping files:
$frame->DragAcceptFiles(1);
EVT_DROP_FILES( $frame, \&doit );
sub doit { warn "@_\n" }
but i cannot for the life of me figure out how to associate the
dropped file with a file handle. if you could give me an example
it would be appreciated, i have read about events and i just cant
seem to figure it out. i have tried my $file = @_; and my $ file =
@_[0]; ect ect and i cannot get it to work. when i use warn it
shows in console that the file was dropped onto frame, but i
cannot figure out how to associate the file with a file handle :(
i have spend countless nights trying to figure this out and i
cannot. i am pretty new to this and kind of new to programming in
general and i swear to god, if you would just show me a working
example i would praise you for the rest of my life lol. i just
need to figure out how to associate the dropped file with a file
handle.