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 » gui crashes.
Re: gui crashes. [message #19605 is a reply to message #19604] Mon, 22 December 2008 16:58 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I couldn't reproduce the problem with MSC8 on XP. I suspect the problem is caused by refilling the TreeCtrl in TopWindow::Paint. This should really be done when you add the new device, which would also make your code much shorter and cleaner.

There are a couple of other tips you might find useful:
- Instead of using 'new' to create the Devices you should make it Moveable or use Array. 'new' is almost never needed with Upp.
- Unless you are doing something very complicated in the real application you could just store the Devices directly in the TreeCtrl as keys, for even simpler code. If you add Value conversion to Devices:
	operator Value() const				{ return RawToValue<Devices>(*this); }
	Devices &operator=(const Value &v) 	{ *this = ValueTo<Devices>(v); }

then your createDevice function becomes:
bool TreeTest::createDevice(int handle)
{
    Devices newDevice(handle, "0.0.0.0");
    newDevice.setName(Format("nummer: %d",_counter));
    _myTree.Add(0, Image(), newDevice, newDevice.getName());
    _counter++;
    return true;
}

This will also make Drag-Drop much easier as you don't have to mirror the changes in your storage container.

[Updated on: Mon, 22 December 2008 17:03]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Drag & Drop , Sort, GetValue( x )
Next Topic: ArrayCtrl as a node of TreeCtrl
Goto Forum:
  


Current Time: Wed May 15 02:04:45 CEST 2024

Total time taken to generate the page: 0.02106 seconds