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 » U++ Widgets - General questions or Mixed problems » Controls & classes design questions
Re: Controls & classes design questions [message #11044 is a reply to message #11036] Thu, 16 August 2007 11:46 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Hello and welcome,

I think your design is mixing up access to controls and data at different levels and will probably lead to complications later. For instance: why does MyFile need access to the TabCtrl? Shouldn't that be managed by the MainWindow?

Personally I would do it something like this:
class MyFile : public GLCtrl {
    MyFile();

    virtual void GLPaint();
    //...
};
//...
class MainWindow : public TopWindow
{
    TabCtrl        tabs;
    Array<MyFile> files;
};
//...
void MainWindow::OnNew()
{
    
    MyFile &file = files.Create<MyFile>();
    file.SizePos();
    tabs.Add(file, "filename");
}

You need to inherit from GLCtrl and overload GLPaint to be able to draw anything.

I'll try and answer your other questions about Moveable, but I'm not 100% so if I get something wrong hopefully someone will correct me:
2) I'm confused about this, because MSC8 won't even compile the code you posted, let alone run it.
3) No Ctrl or derived class is Moveable because they contain internal pointers to other Ctrls. However, what is not clear from the docs is that virtual methods are Moveable, but abstract methods are not (ie. virtual void Abstract() = 0; is not allowed). Array can store non-moveable types, but Vector et al. cannot.
4) As far as I can see you shouldn't need a copy-constructor.

Hope that helps,
James
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multithreading ans updating widgets
Next Topic: DropList bug when removing last item
Goto Forum:
  


Current Time: Fri Aug 29 18:04:10 CEST 2025

Total time taken to generate the page: 0.04542 seconds