$file $x $y are three undefined variables -- wx will complain

This works for me on windows

$frame->DragAcceptFiles(1); EVT_DROP_FILES( $frame, \&doit ); sub doit { warn "@_\n" }

Why that?

Read these links (and what they link) Re^3: WxPerl DnD , Re^3: WxPerl DnD

Also for reference :) my wxWidgets / wxPerl / wxGlade tutorial and there also exists https://github.com/jmlynesjr/wxPerl-wxBook-Examples/ and it probably has drag drop example, just like wxperl_demo --show "Drag and drop"

Also, interleaving code and subs is bad :)

use ... Main( @ARGV ); exit( 0 ); ... sub
see Re: No such file or directory error/No such file or directory error, see template at (tye)Re: Stupid question (and see one discussion of that template at Re^2: RFC: Creating unicursal stars

Another thing i am trying to figure out is how to share a variable from a subroutine and pass it to print in the listbox?

What "subroutine", what variable where and for what purpose? The same principles apply to wxPerl, see write Tk callbacks all lexically scoped and not-memory leaking with no nested subs ever :) avoid nested subs and closures because nested named subs because they're closures

You register event handlers UPON widget objects (wxWindow a wxObject), so each event handler gets as first argument that wxObject ... there is even a global Wx::wxTheApp() which you can also use as a stash (better if the frames keep track of their own data) ... more words and/or more code gets more clear answer


In reply to Re: WxPerl and drag and dropping files by Anonymous Monk
in thread WxPerl and drag and dropping files by james28909

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.