From: Kevin Walzer on 19 Mar 2010 23:04 I'm trying to set up a tablelist widget as a drop target for tkdnd 2.0, and am having difficulty. This code should work, but doesn't produce valid drops. Has anyone used tkdnd with tablelist? If so, can you suggest what I might fix here? package require Tk package require tablelist package require tkdnd tablelist::tablelist .t -columns {0 "First Column" 0 "Another column"} -stretch all -background white pack .t .t insert end [list "first row" "another value"] .t insert end [list "another row" "bla bla"] tkdnd::drop_target register .t bind .t <<Drop>> {puts %D} -- Kevin Walzer Code by Kevin http://www.codebykevin.com
From: Kevin Walzer on 19 Mar 2010 23:57 On 3/19/10 11:04 PM, Kevin Walzer wrote: > I'm trying to set up a tablelist widget as a drop target for tkdnd 2.0, > and am having difficulty. This code should work, but doesn't produce > valid drops. Has anyone used tkdnd with tablelist? If so, can you > suggest what I might fix here? > > package require Tk > package require tablelist > package require tkdnd > > > tablelist::tablelist .t -columns {0 "First Column" 0 "Another column"} > -stretch all -background white > pack .t > .t insert end [list "first row" "another value"] > .t insert end [list "another row" "bla bla"] > > tkdnd::drop_target register .t > > bind .t <<Drop>> {puts %D} > > Forgot two things: I have to specify an argument to the "register" command, and I have to use [bodypath] for the tablelist widget. The code below works: package require Tk package require tablelist package require tkdnd tablelist::tablelist .t -columns {0 "First Column" 0 "Another column"} -stretch all -background white pack .t .t insert end [list "first row" "another value"] .t insert end [list "another row" "bla bla"] tkdnd::drop_target register [.t bodypath] * bind [.t bodypath] <<Drop>> {puts %D} -- Kevin Walzer Code by Kevin http://www.codebykevin.com
From: George Petasis on 20 Mar 2010 14:38 στις 20/3/2010 5:57 πμ, O/H Kevin Walzer έγραψε: > On 3/19/10 11:04 PM, Kevin Walzer wrote: >> I'm trying to set up a tablelist widget as a drop target for tkdnd 2.0, >> and am having difficulty. This code should work, but doesn't produce >> valid drops. Has anyone used tkdnd with tablelist? If so, can you >> suggest what I might fix here? >> >> package require Tk >> package require tablelist >> package require tkdnd >> >> >> tablelist::tablelist .t -columns {0 "First Column" 0 "Another column"} >> -stretch all -background white >> pack .t >> .t insert end [list "first row" "another value"] >> .t insert end [list "another row" "bla bla"] >> >> tkdnd::drop_target register .t >> >> bind .t <<Drop>> {puts %D} >> >> > > Forgot two things: I have to specify an argument to the "register" > command, and I have to use [bodypath] for the tablelist widget. The code > below works: > > package require Tk > package require tablelist > package require tkdnd > > > tablelist::tablelist .t -columns {0 "First Column" 0 "Another column"} > -stretch all -background white > pack .t > .t insert end [list "first row" "another value"] > .t insert end [list "another row" "bla bla"] > > tkdnd::drop_target register [.t bodypath] * > > bind [.t bodypath] <<Drop>> {puts %D} > > > So, is the problem now solved? George
From: Kevin Walzer on 20 Mar 2010 14:44 On 3/20/10 2:38 PM, George Petasis wrote: > > So, is the problem now solved? > > George Yes, it is! --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com
|
Pages: 1 Prev: fcopy -size limit Next: widget suggestion for multicolumn listbox with checkbuttons |