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.
gui crashes. [message #19592] Mon, 22 December 2008 01:49 Go to next message
sapiency is currently offline  sapiency
Messages: 56
Registered: September 2008
Member
hi,

I use Refresh() at the end of the method where I create an Element in the Vector.

The Method Paint() of my Window I have overloaded and it looks if there are new elements in the Vector. If so it
clears the Tree and build it new. If I insert Elements in the Toolbar manually by clicking on the Button (very fast Wink ) the gui crashes. I'm using Refresh() because I want to see the changes directly after I insert a new element.

Any Idea how to avoid this?

the logfile ...:
[12/22/2008 01:29:08.542] DeviceTree::createDummyDevice()
[12/22/2008 01:29:09.722] DeviceTree::createDummyDevice()
[12/22/2008 01:29:09.1003] DeviceTree::createDummyDevice()
[12/22/2008 01:29:09.1103] DeviceTree::createDummyDevice()
[12/22/2008 01:29:09.1303] DeviceTree::createDummyDevice()
[12/22/2008 01:29:09.1464] DeviceTree::createDummyDevice()
[12/22/2008 01:29:09.1634] DeviceTree::createDummyDevice()
[12/22/2008 01:29:10.1794] DeviceTree::createDummyDevice()
[12/22/2008 01:29:10.1954] DeviceTree::createDummyDevice()
[12/22/2008 01:29:10.2104] DeviceTree::createDummyDevice()
[12/22/2008 01:29:10.2295] DeviceTree::createDummyDevice()
[12/22/2008 01:29:10.2465] DeviceTree::createDummyDevice()
[12/22/2008 01:29:10.2635] DeviceTree::createDummyDevice()
[12/22/2008 01:29:11.2795] DeviceTree::createDummyDevice()
[12/22/2008 01:29:11.2986] DeviceTree::createDummyDevice()
[12/22/2008 01:29:11.3196] DeviceTree::createDummyDevice()
[12/22/2008 01:29:11.3386] DeviceTree::createDummyDevice()
[12/22/2008 01:29:11.3557] DeviceTree::createDummyDevice()
[12/22/2008 01:29:12.3717] DeviceTree::createDummyDevice()
[12/22/2008 01:29:12.3897] DeviceTree::createDummyDevice()
Assertion failed in c:\upp\uppsrc\CtrlCore\Win32Proc.cpp, line 77
IsNull(sPainting)


regards

reinhard

[Updated on: Mon, 22 December 2008 12:12]

Report message to a moderator

Re: gui crashes. [message #19600 is a reply to message #19592] Mon, 22 December 2008 11:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Without the code, impossible to say. Do not waste the forum space with .bmp and send a testcase instead.

BTW, ideally make testcase as whole directory and make your forum nick a part of package name, like 'sapiency_TreeDndBug1'.

Mirek
Re: gui crashes. [message #19604 is a reply to message #19600] Mon, 22 December 2008 15:06 Go to previous messageGo to next message
sapiency is currently offline  sapiency
Messages: 56
Registered: September 2008
Member
ok?

regards

reinhard

ps: I included a small jpg in the archive and will therefore remove the archive later ... I don't want to waste your disc - space on the server.
Re: gui crashes. [message #19605 is a reply to message #19604] Mon, 22 December 2008 16:58 Go to previous messageGo to next 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

Re: gui crashes. [message #19609 is a reply to message #19605] Mon, 22 December 2008 20:13 Go to previous messageGo to next message
sapiency is currently offline  sapiency
Messages: 56
Registered: September 2008
Member
hi,

thanks I try to get in Ultimate step by step Wink and I'm glad to get tips. It's nice to see what's possible to do with 'Value'.

But I think it's much cheaper to store the devices in something like a Vector. Each device has more than 100 parameters and the devices are mostly connected to real Devices. There are different views on the structure placed in the main window.

Because I want that the tree shows the order too, I started to make the changes in the tree (D&D) directly in the Vector and therefore I have to sort the Devices in the Vector. Swapping pointers should be cheaper or?

Last night I was in for a shock when the gui crashed. I was happy to find a solution that fits to my idea and the requirements. Just working on a tree without direct link to the devicestructure.

But your tip shows me other possibilities.

Thanks.

reinhard
Re: gui crashes. [message #19646 is a reply to message #19605] Sat, 27 December 2008 23:38 Go to previous message
sapiency is currently offline  sapiency
Messages: 56
Registered: September 2008
Member
mrjt wrote on Mon, 22 December 2008 16:58

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.



I compiled it with the prebuild Release 643 ... No problems any more ...

But there are allways the same problems, even with the new example (see other post ) with the Release 2008.1 (with mingw) from July

regards
reinhard

[Updated on: Sat, 03 January 2009 17:10]

Report message to a moderator

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


Current Time: Fri Mar 29 09:32:03 CET 2024

Total time taken to generate the page: 0.01288 seconds