[CLOSED] Creating custom control

  1. #1

    [CLOSED] Creating custom control

    Is there a guide to create a custom control that inherits from an existing control? For example, I created a new Ext.ux.ChartImage that inherits from Ext.net.Image. I have the clientside object all set up. When I create a new server ChartImage class, how do I add custom listener to it? I created a new ChartImageListeners class that inherits from ImageListeners, but Image.Listener is not virtual. How can I override Image.Listener to use my new ChartImageListeners?
    Last edited by Daniil; Dec 31, 2010 at 6:27 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Yes, there is a problem with listeners and direct events properties (you cannot override it with another type). Tehrefore we split class on two classes: base class (all properties and methods) and final class (listeners, direct events, resources and instance info)

    I split Image to Image and ImageBase classes, please update from SVN and inherit own class from ImageBase (do not forget to override ConfigOptions to include Listeners and DirectEvents)
    /// <summary>
            /// 
            /// </summary>
    		[Browsable(false)]
            [EditorBrowsable(EditorBrowsableState.Never)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    		[XmlIgnore]
            [JsonIgnore]
            public override ConfigOptionsCollection ConfigOptions
            {
                get
                {
                    ConfigOptionsCollection list = base.ConfigOptions;
                    
                    list.Add("listeners", new ConfigOption("listeners", new SerializationOptions("listeners", JsonMode.Object), null, this.Listeners ));
                    list.Add("directEvents", new ConfigOption("directEvents", new SerializationOptions("directEvents", JsonMode.Object), null, this.DirectEvents ));
    
                    return list;
                }
            }
  3. #3
    Quote Originally Posted by Vladimir View Post
    Hi,

    Yes, there is a problem with listeners and direct events properties (you cannot override it with another type). Tehrefore we split class on two classes: base class (all properties and methods) and final class (listeners, direct events, resources and instance info)

    I split Image to Image and ImageBase classes, please update from SVN and inherit own class from ImageBase (do not forget to override ConfigOptions to include Listeners and DirectEvents)
    Interesting. So for future reference, should I not inherit from a final class? What if I want to enhance a combobox with more listeners and directevents?

    Thanks for splitting the Image class. Unfortunately, I won't be able to update from SVN because we just finished core testing and will not be able to update our Ext.net dlls. I got around the issue by just adding a function in my ChartImage class to manually create a new generic listener.
  4. #4
    Hi,

    So for future reference, should I not inherit from a final class? What if I want to enhance a combobox with more listeners and directevents?
    If you don't need to add own events then you can inherit from final class

    What if I want to enhance a combobox with more listeners and directevents?
    There is base class for combo, you have to inherit from that class (just we should ensure that final class doesn't have important methods or properties (move all code to base class))

Similar Threads

  1. [CLOSED] Creating custom control on server side
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Feb 21, 2012, 10:15 AM
  2. Replies: 2
    Last Post: Jan 09, 2012, 7:18 AM
  3. [CLOSED] Creating a control by extending the ext:TextField control
    By Shanth in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Sep 12, 2011, 2:58 PM
  4. [CLOSED] Best practive for creating custom/composite controls
    By anup in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 04, 2011, 11:47 AM
  5. [CLOSED] creating a custom class?
    By smmille1 in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jul 09, 2010, 9:31 PM

Tags for this Thread

Posting Permissions