Home » U++ Library support » TreeCtrl » OptionTree - something missing? [FIXED]
Re: OptionTree - something missing? [message #9025 is a reply to message #9016] |
Fri, 13 April 2007 03:58 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
ok think i got that but how does run stop? I want it to stop when the left mouse button gets released and then I want to know where the mouse is so I can check for drop targets.
So far, the mouse cursor doesnt change when am dragging and the run doesnt appear to have any stop condition. Do I need to override LocalLoop?
Nick
class LayerTree : public TreeCtrl
{
public:
typedef LayerTree CLASSNAME;
virtual void RightDown(Point p, dword flags);
virtual void LeftDown(Point p, dword flags);
int GetNodeIDAt(Point p);
};
....
void LayerTree::LeftDown(Point p, dword flags)
{
// here we implement drag and drop for nodes in the tree view
// first see if there is a node at this point p
int i,id=GetNodeIDAt(p);
if(id<0)
return; // didnt click on a node
Rect rc = GetNode(id).ctrl->GetRect();
// draw the node into an image
// sample the tree ctrls view in this rectangle and make an image
Size sz(rc.Width(),rc.Height());
ImageDraw w(sz);
GetNode(id).ctrl->DrawCtrl(w);
Image img = w;
// start local loop and see where it ends
RectTracker rt(*this);
// use the image as a cursor
rt.SetCursorImage(img);
rt.SetMaster(*this);
rt.Run();
// rt.Track(rc,ALIGN_CENTER,ALIGN_CENTER);
}
int LayerTree::GetNodeIDAt(Point p)
{
// step through all nodes in the tree
// and see if one of them contains p
int id,n=GetLineCount(); //all (visible) items
Ctrl* ptr;
Rect rc;
for(int i=0;i<n;i++)
{
id = GetItemAtLine(i);
TreeCtrl::Node node = GetNode(id);
ptr = node.ctrl;
if(ptr)
{
rc = ptr->GetRect();
if(rc.Contains(p))
return id;
}
}
return -1;
}
hmmm, should have start my own thread really...
I tried the following
void LayerTree::LeftUp(Point p, dword flags)
{
m_pRT->EndLoop(); // tried this with recttracker as member pointer
EndLoop(); // and this
}
and nothing appears to have any effect. Am still quite new to UPP and it seems I still have a lot to learn. There does appear to be a loop starting. But I dont understand why the cursor does not change and I don't understand why the master (LayerCtrl) cannot intercept LeftUp and stop the loop. I'm missing something fundamental and obvious it seems.
I think this is the most complex part of my GUI but I need to know it can be done before I go further.
Cheers,
Nick
[Updated on: Fri, 13 April 2007 05:56] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Apr 27 02:46:35 CEST 2024
Total time taken to generate the page: 0.05471 seconds
|