Basicly, I want the possability to be able to drag, say the title (Label) at the top either to the left or right, and drop it anywhere (in the pane I suppose). After that the idea is to rearrange the columns. So, basicly, I wanna be able of rearranging the columns by drag&drop. I read some tutorial on the web (and I have some code in here from that), but if I put the label I wanna have dragable in the $drag_source, the whole label "disapears". Or, well, it seems to be there, but its not packed properly (height 1 pixel or something..?) The idea with 2 frames ($frame1 and $frame2) was to make just ONE of those frames dragable, so I wouldnt get wierd things happening, when it may think I wanna drag the HList. That is, but Label on one frame, and the HList on the other.use Tk; use Tk::HList; use Tk::Pane; use Tk::DragDrop; use strict; use warnings; my $mw = MainWindow->new; my $pane = $mw->Scrolled('Pane', -width => 800, -height => 400, -sticky => 'nsew', -scrollbars => 'os', )->pack(-fill => 'both', -expand => 1); addCol(1); addCol(2); addCol(3); sub addCol { my $id = shift; my $width = 200; my $frame = $pane->Frame( -relief => "ridge", -bd => 1, -width => $width, )->pack(-side => 'left', -fill => 'both', -expand => 1, ); # DnD SUPPORT! #my $frame1 = $frame->Frame()->pack(); #my $frame2 = $frame->Frame()->pack(); my $drag_source = $frame->DragDrop( -event => '<B1-Motion>', -sitetypes => [qw/Local/], ); my $adjuster = $pane->Adjuster(); $adjuster->packAfter($frame, -side => 'left'); my $label = $frame->Label(-width => 30, -text => "Test" . $id, )->pack(-fill => "both"); my $hlist = $frame->Scrolled("HList", -scrollbars => 'osoe', -selectmode => 'extended' )->pack(-fill => "both", -expand => 1); } MainLoop;
In reply to Drag & Drop Problem by Ace128
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |