Is this a good choice? Say I can have 20-30 children and can be loaded in an MDI parent form... Is this a good design?
Thanks in advance.
Printable View
Is this a good choice? Say I can have 20-30 children and can be loaded in an MDI parent form... Is this a good design?
Thanks in advance.
I wouldn't say so. Why do you need so many child forms, what are you doing? I think if you have that many you need to have a design rethink ;)
Any comments on the singleton thing? "Say I can have..." I suppose I misuse the "can have" but I did say "Say", so not necessarily 20-30.
Singleton? You mean where all the windows are floating? I would say that is even worse if you are going to often have that many windows. On the other hand if you aren't often going to have that many then it could be a better choice. It depends really on things like toolbar placement etc.
Maybe you should try the MDI Tab control from vbAccelerator:
http://www.vbaccelerator.com/home/VB...bs/article.asp
That's assuming your using VB6 ;)
Thanks for the link. I guess, I can't use it, I'm with C#. Not really good with it (just staring out) but I guess I can try to learn. Singleton, btw, is a pattern in which only one instance of the class can exists at runtime. It's my choice for now as to dealing with the children to assure only one instance of a certain child can exist. I don't really know if this is good (especially having a large number of children open inside the MDI container).
Sample code of singleton class is something like
in which we have a member variable of her type (class type) representing it as the instance of the class. Also it's a static to assure it's not a member of the object but to the class itself. Contructor also are made private so no one can have the use of the new operator. Accessing it will then be SingletonForm.GetInstance().AndManipulateHere().Code:using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication1
{
/// <summary>
/// Summary description for SingletonForm.
/// </summary>
public class SingletonForm : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private SingletonForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
// if( disposing )
// {
// if(components != null)
// {
// components.Dispose();
// }
// }
// base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "SingletonForm";
}
#endregion
static SingletonForm instance=null;
public static SingletonForm GetInstance()
{
if(instance==null) instance=new SingletonForm();
return instance;
}
}
}
As I said, I don't really know if this is good enough to have all the child as being a singleton. I need help on suggestions.