Revision [32970]
This is an old revision of gtkdialogDocTips9.7 made by zigbert on 2020-08-06 02:21:35.
9.7 Drag'n drop
Gtkdialog has limited support for drag'n drop. This is what we've learnt by now:Drag from file browser to <entry> widget.
export test=" <entry> <default>Drag a directory from Rox</default> </entry>" gtkdialog -p test
Move items in list by drag'n drop. (More info in this thread)
Using the reorderable option in the <tree> has some strange behavior. For example will items get swallowed when moving them onto another item. The workaround restores the list if the user moves item onto, instead of in between 2 other items... This code by MochiMoppel is a result of 2 cracked nuts:
Code below line 12 (break command) is activated when user move item in list
ls -1 /usr/share/backgrounds > /tmp/test do_something () { Xdialog -info "Do something with\n$TREE" x 2000 ;} ; export -f do_something echo ' <vbox> <tree headers-clickable="false" reorderable="true"> <label>Backgrounds</label> <input>cat /tmp/test</input> <output file>/tmp/test</output> <variable>TREE</variable> <height>300</height><width>200</width> <action>do_something &</action> <action signal="button-release-event" condition="command_is_true( echo $PTR_Y )">break:</action> <action signal="button-release-event">save:TREE</action> <action signal="button-release-event">activate:BTN_SAVE</action> </tree> <button visible="false"> <variable>BTN_SAVE</variable> <action>cp /tmp/test /tmp/testbackup</action> <action>save:TREE</action> <action condition="command_is_true([[ $(wc </tmp/test) != $(wc </tmp/testbackup) && sed \"s/^|*//\" /tmp/testbackup > /tmp/test && echo true )">refresh:TREE</action> </button> </vbox>' | gtkdialog -s