Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TreeCtrl » TreeCtrl Scroll triggers Parent Refresh
Re: TreeCtrl Scroll triggers Parent Refresh [message #11336 is a reply to message #11331] Thu, 06 September 2007 00:36 Go to previous messageGo to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Absolutely, here is the simplest I can find (I added the frames to show it overpainting - they are not necessary).


#include "CtrlLib/CtrlLib.h"

using namespace Upp;


struct App : TopWindow {
	TreeCtrl   tree;
	SplitterFrame m_sf;
	ToolBar tools;
	StatusBar status;
	MenuBar menu;

	typedef App CLASSNAME;

	void DropInsert(int parent, int ii, PasteClip& d)
	{
		tree.AdjustAction(parent, d);
		if(AcceptInternal<TreeCtrl>(d, "mytreedrag")) {
			tree.InsertDrop(parent, ii, d);
			tree.SetFocus();
			return;
		}
		if(AcceptText(d)) {
			tree.SetCursor(tree.Insert(parent, ii, Image(), GetString(d)));
			tree.SetFocus();
			return;
		}
	}

	void Drag()
	{
		if(tree.DoDragAndDrop(InternalClip(tree, "mytreedrag"),
		                       tree.GetDragSample()) == DND_MOVE)
			tree.RemoveSelection();
	}

	App() {
		Ctrl::ShowRepaint(50);

		AddFrame(TopSeparatorFrame());
		AddFrame(menu);
		AddFrame(TopSeparatorFrame());
		AddFrame(tools);
		AddFrame(TopSeparatorFrame());
		AddFrame(status);
		
		
		AddFrame(m_sf.Left(tree.SizePos(),250));
		AddFrame(InsetFrame());
		
//		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);	

			parent.Add(tree.Add(parent[rand() % parent.GetCount()], node)); // mine

//			parent.Add(tree.Add(parent[rand() % parent.GetCount()], CtrlImg::File(),
//					            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();
		
	}
};



GUI_APP_MAIN
{
	App().Run();
}


Please let me know if you need more info.

Nick
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Right Clicking Tree Nodes?
Next Topic: Like the new Drag and Drop TreeCtrl but...
Goto Forum:
  


Current Time: Tue May 14 08:52:15 CEST 2024

Total time taken to generate the page: 0.01958 seconds