Forum  Commercial Foru...  Commercial Foru...  Custom CollectionEditor
Previous Previous
 
Next Next
New Post 6/7/2012 8:54 AM
  Valter.Venturini
138 posts
5th Level Poster


Custom CollectionEditor 

 Hi,

i've have a Customized TabControl and a Customized TabPage, now i need to add CustomTabPages in CustomTabControl at Design-time.

This is generally accomplished creating a Custom CollectionEditor, i''ve tried to do the same with VWG framework but it doesn't seem to work, Visual Studio 2010 crash when i try to access TabControl Properties.

I've also tried to debug and i get a NullReferenceException.

this is the code i'm using: 

 

public class ItsTabPageCollectionEditor : CollectionEditor

        {

            

            public ItsTabPageCollectionEditor()

                : base(typeof(TabPageCollection))

            {

            }

 

            protected override Type[] CreateNewItemTypes()

            {

                Type[] ret = null;

                ret = new Type[] { typeof(ItsTabPage) };

                return ret;

            }

        }

 

 [Editor(typeof(ItsTabPageCollectionEditor), typeof(UITypeEditor))]

 public new TabPageCollection TabPages { get { return base.TabPages; } }

 

 Thanks in advance

Nicola

 


R&D Team - Italstudio
 
New Post 6/7/2012 12:36 PM
  palli
14415 posts
1st Level Poster




Re: Custom CollectionEditor 
Modified By palli  on 6/7/2012 3:37:09 PM)

 Hi Nicola,

Regretfully, we do not yet have much documentation for design time customizations, but what we have is summarized and put into very simple samples here. From this paragraphs you will learn that Visual WebGui uses Controllers for design time controlling.

I'm not sure if it covers your needs here, but in order to override this property and use design time customization, the basics would be something like this:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;

using Gizmox.WebGUI.Forms;
using Gizmox.WebGUI.Forms.Design;
using Gizmox.WebGUI.Common.Extensibility;
using Gizmox.WebGUI.Client;
using Gizmox.WebGUI.Common.Interfaces;

namespace App20120607cVS2010
{
    [DesignTimeController("App20120607cVS2010.MyCustomController, App20120607cVS2010")]
    [ClientController("App20120607cVS2010.MyCustomController, App20120607cVS2010")]
    public class CustomTabControl : TabControl 
    {

        public new TabPageCollection TabPages { get { return base.TabPages; } }
  
    }

    public class MyCustomController : Gizmox.WebGUI.Client.Controllers.TabControlController  
    {
        		/// <summary>
		///
		/// </summary>
		/// <param name="objWebTreeView"></param>
		/// <param name="objWinTreeView"></param>
		public MyCustomController(IContext objContext,object objWebObject,object objWinObject) :base(objContext,objWebObject,objWinObject)
		{
		}
		
		/// <summary>
		///
		/// </summary>
		/// <param name="objWebTreeView"></param>
		/// <param name="objWinTreeView"></param>
        public MyCustomController(IContext objContext, object objWebObject)
            : base(objContext, objWebObject)
		{
		}
    }
}
 

You can find most of the design-time controllers available in the Gizmox.WebGUI.Client project, which is a part of our public source code.

Hope this helps a bit.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 6/8/2012 8:34 AM
  Valter.Venturini
138 posts
5th Level Poster


Re: Custom CollectionEditor 

 Hi Palli,

i've solved the problem redefining the TabPageCollection with a CustomTabPageCollection, in this way visual studio build automatically a Custom CollectionEditor.

This brings me to another problem :) , when i drag a CustomTabControl on a Form two "Standard" TabPage are created and added to CustomTabControl. There is a way to prevent this?

Ps: i'm sending a sample at support.

Thanks in advance.

Nicola


R&D Team - Italstudio
 
New Post 6/8/2012 5:29 PM
  palli
14415 posts
1st Level Poster




Re: Custom CollectionEditor 

 Hi Nicola,

Thanks for the sample. 

After studying this quite a bit, my conclution is that the WinForms TabControl, which is used by the Visual WebGui designer, is the one adding those TabPages to your custom TabControl and the Visual WebGui design time simply adds a copy to sync it with the WinForms control. I am waiting on more info from our developers, as there may be a solution to this, but the problem is that it is within our private code and I can't publish it without permission.

In addition, I think that you may need to change the TabPage collection a bit and have your CustomTabPageCollection inherit from TabPageCollection, as well as have the CustomTabControl.TabPages property use the base.TabPages, but I will have to explore this a bit further when I get a response from our developers. 

I will update you on this thread as soon as I have more information.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 6/10/2012 11:42 AM
  palli
14415 posts
1st Level Poster




Re: Custom CollectionEditor 

 Hi Nicola,

Please find an updated sample here

The modifications I made were to have CustomTabPageCollection inherit from TabPageCollection, and there is some additional code you will find within the CustomTabControlController, a code that will firstly get rid of the standard TabPage objects added by the Windows Forms TabControl designer, and then also code to add two CustomTabPage objects to the CustomTabControl. 

You can easily modify the code to stop having it add the CustomTabPage pages, as the required wiring is there.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  Custom CollectionEditor
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS