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 » Distorted GUI / memory leak
Re: Distorted GUI / memory leak [message #25583 is a reply to message #25582] Tue, 02 March 2010 05:41 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

/* Plugins */
static StaticCriticalSection sAnyStoragePlugin;
class StoragePlugin {

	typedef StoragePlugin *(*StorageFactory)();
	template <class T> static StoragePlugin *FactoryFn() { return new T; }

	static void AddPlugin(StorageFactory f) { INTERLOCKED_(sAnyStoragePlugin)Map().Add(f); }
	static Array<StorageFactory>& Map() { static Array<StorageFactory> x; return x; }

public:
	template <class T> static void Register() { AddPlugin(&StoragePlugin::FactoryFn<T>); }
};

class DiskStorage : public StoragePlugin {
	TreeCtrl  c;  // <<<< Comment me to get a correct GUI and remove the memory leak
	Button    b;
};

INITBLOCK {
	StoragePlugin::Register<DiskStorage>();
}

/* App */
class DeBunny : public TopWindow {
	Button button;
	    
public:
	typedef DeBunny CLASSNAME;
	DeBunny() {
            Add(button.SetLabel("&I'm an Ultimate++ button!").VCenterPos(20).HCenterPos(200));
	};
};

GUI_APP_MAIN
{
	DeBunny().Run();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OptionTree loses check state
Next Topic: Restrict drag&drop to one level
Goto Forum:
  


Current Time: Sat May 11 11:00:13 CEST 2024

Total time taken to generate the page: 0.03036 seconds