What is needed to do reorder-by-dragging in HyperTreeList

Hello,

Did anyone ever implement a reorder-by-dragging behavior in
HyperTreeList? I want the user to be able to change the order of the
items by dragging them around.

Has anyone ever done anything like this? I don't know how to do it.

Thanks,
Ram.

Hi Ram,

Did anyone ever implement a reorder-by-dragging behavior in
HyperTreeList? I want the user to be able to change the order of the
items by dragging them around.

In Task Coach, a tree widget (implemented with HyperTreeList) takes a
"model" that contains the data and provides methods for getting at the
data (like model.getChildren(domainObject) and
model.getItemText(domainObject, columnIndex)). The tree widget
refreshes itself whenever it is told to do so. Supporting dragging and
drop is done by rearranging the model in the onDrop event handler and
then telling the tree widget to refresh itself.

HTH, Frank

···

2010/9/30 cool-RR <ram.rachum@gmail.com>:

I have the same thing in my app, so if I reorder the list of items in
memory and refresh the tree, then the tree gets updated with the new
order.

My question is, how do I make it so the user can drag and drop items
in the tree and have that change the order of the list of items?

Ram.

···

On Oct 3, 7:40 pm, Frank Niessink <fr...@niessink.com> wrote:

Hi Ram,

2010/9/30 cool-RR <ram.rac...@gmail.com>:

> Did anyone ever implement a reorder-by-dragging behavior in
> HyperTreeList? I want the user to be able to change the order of the
> items by dragging them around.

In Task Coach, a tree widget (implemented with HyperTreeList) takes a
"model" that contains the data and provides methods for getting at the
data (like model.getChildren(domainObject) and
model.getItemText(domainObject, columnIndex)). The tree widget
refreshes itself whenever it is told to do so. Supporting dragging and
drop is done by rearranging the model in the onDrop event handler and
then telling the tree widget to refresh itself.

HTH, Frank

Here's my implementation with a regular wx.Tree - ~sproaty/whyteboard/development : contents of whyteboard/gui/panels.py at revision 451

Maybe I'm doing more than is needed; took forever to get it working so that it wouldn't segfault though. the code's a little tricky but it seemed the only way
self.tab is an ordered list of all wx.TreeItems in the tree.

···

On 03/10/2010 18:50, cool-RR wrote:

On Oct 3, 7:40 pm, Frank Niessink<fr...@niessink.com> wrote:

Hi Ram,

2010/9/30 cool-RR<ram.rac...@gmail.com>:

Did anyone ever implement a reorder-by-dragging behavior in
HyperTreeList? I want the user to be able to change the order of the
items by dragging them around.

In Task Coach, a tree widget (implemented with HyperTreeList) takes a
"model" that contains the data and provides methods for getting at the
data (like model.getChildren(domainObject) and
model.getItemText(domainObject, columnIndex)). The tree widget
refreshes itself whenever it is told to do so. Supporting dragging and
drop is done by rearranging the model in the onDrop event handler and
then telling the tree widget to refresh itself.

HTH, Frank

I have the same thing in my app, so if I reorder the list of items in
memory and refresh the tree, then the tree gets updated with the new
order.

My question is, how do I make it so the user can drag and drop items
in the tree and have that change the order of the list of items?

Ram.

--
Steven Sproat, BSc
http://www.whyteboard.org/

Well, you need to catch the wx.EVT_TREE_BEGIN_DRAG event and then
later the wx.EVT_TREE_END_DRAG event.

See the TreeCtrlDragAndDropMixin class in

Cheers, Frank

···

2010/10/3 cool-RR <ram.rachum@gmail.com>:

My question is, how do I make it so the user can drag and drop items
in the tree and have that change the order of the list of items?