Home » U++ Library support » TreeCtrl » Distorted GUI / memory leak
Distorted GUI / memory leak [message #25582] |
Mon, 01 March 2010 22:33 |
galious
Messages: 28 Registered: March 2008
|
Promising Member |
|
|
Hi,
I'm trying to create a 'static-linked plugin system' like is done for e.g. plugin/bmp and plugin/png. The plugins should provide a GUI to allow the users to set some configuration. Providing the controls works for buttons, but adding a treectrl results in a distorted UI (the text in the provided is not centered anymore) and a memory leak.
What am I doing wrong? Is this not supported or is this a bug somewhere in the upp code?
For an example see the code below.
Best regards,
Martin
#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<StoragePlugin>& Map() { static Array<StoragePlugin> 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();
}
|
|
|
Goto Forum:
Current Time: Sun Apr 28 07:58:35 CEST 2024
Total time taken to generate the page: 0.05811 seconds
|