Here is rough translation of BWidget example: Drag and Drop Demo, not very difficult, does require learning TCL (easy with tkdocs tutorial), I don't think it will help David
#!/usr/bin/perl -- use strict; use warnings; use Tkx; Main(@ARGV); exit(0); sub Main { local $Tkx::TRACE = 64; Tkx::package_require('tile'); Tkx::package_require('BWidget'); eval { Tkx::tile__setTheme('xpnative'); 1 } || eval { Tkx::ttk__setTheme('xpnative'); 1 }; drawGUI(); Tkx::MainLoop(); } ## end sub Main sub drawGUI { our @wList; #~ http://wiki.tcl.tk/16126# BWidget example: Drag and Drop Demo #~ wm withdraw . #~ Tkx::wm_withdraw('.'); #~ set t [toplevel .t] #~ wm title $t "BWidgets Demo for Drag 'n Drop enabled buttons." our $t = Tkx::widget->new("."); $t = $t->new_toplevel( -name => ".t" ); $t->g_wm_title("BWidgets Demo for Drag 'n Drop enabled buttons.") ; ## wm title $t "BWidgets Demo for Drag 'n Drop enabled button +s." #~ use DDS; Dump($t); #~ # $Tkx_widget1 = \do { my $v = '.t' }; #~ # bless( $Tkx_widget1, 'Tkx::widget' ); #~ proc wrap {wtype wpath args} { #~ if { [catch {uplevel "#0" package require tile}] == 0 } { #~ return [eval ttk::${wtype} $wpath $args] #~ } else { #~ return [eval $wtype $wpath $args] #~ } #~ } #~ sub wrap { #~ my( $wtype ) = shift; #~ $wtype = "Tkx::new_ttk__$wtype"; #~ return $wtype->(@_); #~ } #~ pack [set f [wrap frame $t.f]] -fill both -expand true #~ pack [set f [ttk::frame $t.f]] -fill both -expand true $t = $t->new_ttk__frame( -name => '.t.f' ); $t->g_pack(qw' -fill both -expand true '); #~ pack [wrap button $f.b1 \ #~ -text "1.) Drag" -image [Bitmap::get new] -compound le +ft \ #~ -command {tk_messageBox -message "Drag"}] -padx 5 -pad +y 5 #~ pack [wrap button $f.b2 \ #~ -text "2.) and" -image [Bitmap::get file] -compound l +eft \ #~ -command {tk_messageBox -message "and"}] -padx 5 -pady + 5 #~ pack [wrap button $f.b3 \ #~ -text "3.) Drop" -image [Bitmap::get copy] -compound l +eft \ #~ -command {tk_messageBox -message "Drop"}] -padx 5 -pad +y 5 #~ pack [wrap button $f.b4 \ #~ -text "4.) Demo" -image [Bitmap::get redo] -compound l +eft \ #~ -command {tk_messageBox -message "Demo"}] -padx 5 -pad +y 5 for my $i ( 1 .. 4 ) { my $m = (qw' 0 Drag and Drop Demo ')[$i]; my $bb = $t->new_ttk__button( -name => "$t.b$i", # auto-name is .b .b2 .b3... -image => Tkx::Bitmap__get( (qw'0 new file copy redo ')[$i] ), -text => "$i.) $m", -command => sub { print "$m\n"; }, ); $bb->g_pack; } ## end for my $i ( 1 .. 4 ) #~ enableDnD [list $f.b1 $f.b2 $f.b3 $f.b4] enableDnD( map { "$t.b$_" } 1 .. 4 ); #~ pack [wrap label $f.lbl -text ""] -padx 5 -pady 5 #~ pack [wrap button $f.b5 -text "Exit Demo." -command {exit 0}] - +padx 5 -pady 5 $t->new_ttk__label( -text => "" )->g_pack(qw' -padx 5 -pady 5 '); $t->new_ttk__button( -text => "Exit Demo", #~ -command => sub { Tkx::destroy('.'); exit; }, -command => [ \&Tkx::destroy, '.' ], )->g_pack(qw' -padx 5 -pady 5 '); #~ Tkx::raise('.'); } ## end sub drawGUI sub enableDnD { for my $w (@_) { # Here we register the widget as a dropsite. #~ Tkx::BWidget__DropSite__register( #~ Tkx::DropSite__register( Tkx::DropSite__register( $w, #~ -dropcmd => \&dropbuttonCmd, -dropcmd => sub { print "dropbuttonCmd\n" }, #~ http://docs.activestate.com/activetcl/8.6/bwidget/DropSite.html #~ -droptypes => { #~ BUTTON_ITEM => {copy => {}, move => {} , link => { +}}, #~ }, ); # Here we register the widget as a dragsite. Tkx::DragSite__register( $w, -dragevent => 1, #~ -draginitcmd => \&dragbuttonCmd, #~ -dragendcmd => \&droppedOntoButtonCmd, -draginitcmd => sub { print "dragbuttonCmd\n"; print "\t $_\n" for @_; print "\t--\n"; }, -dragendcmd => sub { print "droppedOntoButtonCmd\n"; print "\t $_\n" for @_; print "\t--\n"; }, ); # Here we have to bind the data type BUTTON_ITEM to the mouse. #~ Tkx::DragSite__include(qw' Widget BUTTON_ITEM <B1-Motion> '); } ## end for my $w (@_) } ## end sub enableDnD

In reply to Re^5: Drag and Drop in Tkx by Anonymous Monk
in thread Drag and Drop in Tkx by David S

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.