Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: PAR PP Executable/drag and drop: msg#00001

lang.perl.par

Subject: Re: PAR PP Executable/drag and drop

Joshua and Candace Garrett wrote:

--- "the.noonings" <the.noonings@xxxxxxxxxxx> wrote:


Joshua Garrett wrote:


Hi,

I've created a PAR PP executable for OS X and

Windows, and notice a

substantial difference. On Windows, the executable

supports drag and drop,

with any dropped files/directories passed to ARGV.

On the Mac, the

executable does not support drag and drop.

Is there a way to make drag and drop work on an OS

X PAR executable, without

resorting to Dropscript or Platypus?

I need a standalone executable with drag and drop.

Thanks,

joshua




This is not a shot in the dark. It may be a shot in
the shadows.

I was believing the same thing for Linux. D&D
worked fine on Windows, and D&D worked on Linux with the old Perl/Tk. However, with the newest version of Perl/Tk, Tk-804.027 11 Apr 2004 - Nick
Ing-Simmons, D&D only worked on Windows. I had faithfully followed
the examples, and did not change anything in my code. I did not really
care so I did not report it. Then one day my eye caught something in
the "sub accept_drop" from some drag and drop web examples
where I originally got the code..

See "FILE_NAME" below? I changed it to "STRING" as
you see because that is what the Windows section of sub accept_drop had.
------------- paste
$string_dropped =
$widget->SelectionGet(-selection => $selection,
# 'FILE_NAME');
'STRING');
------------- end paste
From the on, Drag and Drop worked fine for the new
Tk, too.

To save some others some work, I am pasting a file
called "test_drag_and_drop.pl that works on Windows and
Linux. First though, let me state that I know this may not have anything
to do with why it does not work on a Mac, except perhaps if you used
the same original example code I did. In any case, please let us know
if this works on your Mac machine.
Thanks
-------------------------- paste
test_drag_and_drop.pl
#!/usr/bin/perl -w
# file: test_drag_and_drop.pl
#################
use Tk;
use Tk::DropSite;

#################
use strict;
#################
use vars qw($mw $textbox);
#################

#################
sub accept_drop {
my($widget, $selection) = @_;

my $string_dropped;
eval {
if ($^O eq 'MSWin32') {
$string_dropped =
$widget->SelectionGet(-selection => $selection,
'STRING');
} else {
$string_dropped =
$widget->SelectionGet(-selection => $selection,
# 'FILE_NAME');
'STRING');
}
};
if (defined $string_dropped) {
$widget->insert('end', $string_dropped . "\n");
}
}

#################
sub print_string_and_exit {
my ($mw, $textbox, ) = @_;

my $string;
$string = $textbox->get("0.0", "end");

print STDOUT "You dragged and dropped
::\n$string\n";

$mw->destroy;

}

#################

$mw = new MainWindow;
$mw->title("Try to Drag and Drop");

$textbox =
$mw->Scrolled('Text', -scrollbars => "osoe",
-height => 10,
-width => 72,
)->pack;


$textbox->DropSite
(-dropcommand => [\&accept_drop, $textbox],
-droptypes => ($^O eq 'MSWin32' ? 'Win32' :
['XDND', 'Sun'])
);


my $okay_button =
$mw->Button( -text => "Okay",
-command => [ \&print_string_and_exit,
$mw,
$textbox,
]
)->pack(
-side => 'left',
-anchor => 'n',
-ipadx => 10,
-expand => 1,
);



#.....................................................................

#########
MainLoop;
#########




Thanks for the thoughtful reply.

The script I wrote does not use Tk! On Windows, PAR
makes it drag-and-droppable all by itself, putting
dragged items in ARGV. On Mac, it does not...

For now I am using Applescript/Platypus shells, but I
am wondering if there is a better way just with PAR.

Thanks again.

Joshua





__________________________________ Do you Yahoo!? Jazz up your holiday email with celebrity designs. Learn more. http://celebrity.mail.yahoo.com


Since you did not state your gui kit, I assumed Perl/Tk Bad assumption. However, if you want to look into Tk, it works just fine on the Mac OSX, according to at least one person I know that has one. It works on Linux and Windows, too. I understands WxPerl is good, too, though I've never used it myself.

Good luck.



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe