|
|
Home » U++ Library support » TreeCtrl » Like the new Drag and Drop TreeCtrl but...
Like the new Drag and Drop TreeCtrl but... [message #11084] |
Sat, 18 August 2007 22:18 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
it would be nice if it worked with images and options too
I saw the example and was thinking of replacing my drag and drop tree ctrl with yours as yours has some advantages over mine such as full selection and dropping into the middle of the hierarchy which mine doesn't do.
However, I tried to modify the example in the following way
App() {
Add(tree.SizePos());
Vector<int> parent, parent2;
Option* option = new Option[10000]; // mine
parent.Add(0);
tree.SetRoot(Image(), "The Tree");
for(int i = 1; i < 10000; i++) {
option[i].SetLabel(FormatIntRoman(i, true)); // mine
TreeCtrl::Node node(CtrlImg::File(),option[i],300); // mine
parent.Add(tree.Add(parent[rand() % parent.GetCount()], node)); // mine
// parent.Add(tree.Add(parent[rand() % parent.GetCount()], Image(),
// FormatIntRoman(i, true)));
if((rand() & 3) == 0)
tree.Open(parent.Top());
}
tree.Open(0);
tree.WhenDropInsert = THISBACK(DropInsert);
tree.WhenDrag = THISBACK(Drag);
tree.MultiSelect();
Sizeable();
}
and it comes up good but when you try to drop a node it crashes
oh and the node selection is weak like in my version.
Is this something that might get added to the UPP TreeCtrl?
Nick
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Like the new Drag and Drop TreeCtrl but... [message #11579 is a reply to message #11307] |
Tue, 18 September 2007 04:15 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hey Mirek,
Just a quick nudge
I just installed 709dev1 and I see something about TreeCtrl has changed as the drag and drop that I implemented myself no longer works (none of the controls draw whilst one is being dragged using tracker - could it be the clipping you fixed?).
Anyhow, I don't want to fix my drag and drop if I will be able to abandon it and use yours (which is admittedly way better) in the near future.
[Updated on: Tue, 18 September 2007 04:17] Report message to a moderator
|
|
|
|
Re: Like the new Drag and Drop TreeCtrl but... [message #11740 is a reply to message #11668] |
Mon, 24 September 2007 16:29 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hey Mirek,
Yes that looks great. However, when I drag and drop a node, after it is dropped it loses its option control. I am using the exact code included in the xxx.zip file.
Is this an error or is it up to me to make sure the option control is copied to the right place?
Nick
[Updated on: Mon, 24 September 2007 16:29] Report message to a moderator
|
|
|
|
Re: Like the new Drag and Drop TreeCtrl but... [message #11779 is a reply to message #11753] |
Tue, 25 September 2007 17:46 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Ok, sounds fair.
However I have another question: why is it that the code inside Drag() never gets executed?
void Drag()
{
if(tree.DoDragAndDrop(InternalClip(tree, "mytreedrag"),
tree.GetDragSample()) == DND_MOVE)
{
PromptOK("hey");
tree.RemoveSelection();
}
}
I added a PromptOK() as you can see above and it never pops up (I made sure to drag the selection to merely a different position on the same parent so there was no logical conflict).
Does that seems right to you?
I'm guessing that if that function did something it would copy the options across as its a MOVE rather than a copy right?
Nick
[Updated on: Tue, 25 September 2007 17:47] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 05:17:54 CEST 2024
Total time taken to generate the page: 0.03180 seconds
|
|
|