StrataFrame Forum

Subclass SF's control

http://forum.strataframe.net/Topic5782.aspx

By kkchan - 1/12/2007

Hi,

May I know anything wrong for code below?

I am facing problem VS.NET will exit automatically if I drop the control (derived from SF control) on form. However, if I changed to derived from standard control (System.WIndows.Forms) then is ok.



Any ideas?



using System;

using System.Collections.Generic;

using System.Text;



using MicroFour.StrataFrame.UI.Windows.Forms;

using System.Windows.Forms;



namespace JK.Framework.UI.Windows.Forms

{

public class LinkLabel : MicroFour.StrataFrame.UI.Windows.Forms.LinkLabel //System.Windows.Forms.LinkLabel //MicroFour.StrataFrame.UI.Windows.Forms.LinkLabel

{

protected override void OnLinkClicked(System.Windows.Forms.LinkLabelLinkClickedEventArgs e)

{

base.OnLinkClicked(e);

this.HandleClicked();



}



protected void HandleClicked()

{

MessageBox.Show("Clickedaa");

}

}

}
By StrataFrame Team - 1/12/2007

Can you drop a LinkLabel from the StrataFrame Controls & Components tab onto a form, or does it kill VS as well?
By Chan - 1/12/2007

Hi,

I can drop Strataframe control to form without any problem, but not my derived control
By StrataFrame Team - 1/15/2007

It might be a type editor problem.  It might be easiest if you take the source code for one of the SF controls... say LinkLabel and copy that into your own control and modify it.  VS isn't always great about informing you of problems at design-time... sometimes it just dies.
By Chan - 1/17/2007

Sorry, I really can't make it after trying and trying.



I got error if I copy code from linklabel. I already added the all necessary references by refer to MicrosFour Strataframe UI.



Do you mind to create a label subclass sample and direction to do this? Sorry for any inconvinience.



Error   1   Type 'ToolboxBitmap' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   34   5   ClassLibrary1

Error   2   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   37   20   ClassLibrary1

Error   3   Type 'ILocalizable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   37   39   ClassLibrary1

Error   4   Type 'IInitOnFormLoad' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   37   53   ClassLibrary1

Error   5   Type 'DataSourceUpdateMode' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   48   39   ClassLibrary1

Error   6   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   59   83   ClassLibrary1

Error   7   Name 'DataSourceUpdateMode' is not declared.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   60   42   ClassLibrary1

Error   8   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   67   57   ClassLibrary1

Error   9   Name 'DataSourceUpdateMode' is not declared.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   68   34   ClassLibrary1

Error   10   Type 'DataSourceUpdateMode' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   79   48   ClassLibrary1

Error   11   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   79   80   ClassLibrary1

Error   12   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   97   61   ClassLibrary1

Error   13   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   114   74   ClassLibrary1

Error   14   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   141   64   ClassLibrary1

Error   15   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   159   75   ClassLibrary1

Error   16   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   174   62   ClassLibrary1

Error   17   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   193   65   ClassLibrary1

Error   18   Type 'ILocalizable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   216   64   ClassLibrary1

Error   19   Type 'ILocalizable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   241   67   ClassLibrary1

Error   20   Type 'ILocalizable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   257   85   ClassLibrary1

Error   21   Type 'ILocalizable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   270   124   ClassLibrary1

Error   22   Type 'ControlUpdateMode' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   290   45   ClassLibrary1

Error   23   Type 'IBusinessBindable' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   301   104   ClassLibrary1

Error   24   Name 'ControlUpdateMode' is not declared.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   311   43   ClassLibrary1

Error   25   Name 'ControlUpdateMode' is not declared.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   315   51   ClassLibrary1

Error   26   Type 'IInitOnFormLoad' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   338   114   ClassLibrary1

Error   27   Type 'IInitOnFormLoad' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   383   72   ClassLibrary1

Error   28   Type 'IInitOnFormLoad' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   400   53   ClassLibrary1

Error   29   Type 'IInitOnFormLoad' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   406   62   ClassLibrary1

Error   30   Type 'IInitOnFormLoad' is not defined.   F:\Projects\JKFramework\ClassLibrary1\Class1.vb   418   53   ClassLibrary1
By Chan - 1/19/2007

Hi,

I tried to create an derived label (mylabel) based on system.windows.ui.forms. Then, I created another derived control based on the mylabel (mymylabel). It works fine when I drop mymylabel to form.



Therefore, I am sure I do it the right way. Just that, I may miss out something which is necessary in order to subclass SF Control. Anyone can help here?



Your helps are really appreciated.



Thank you
By Chan - 1/19/2007

BTW, I am using C#, therefore I cant copy the source code from SF and do modification.
By StrataFrame Team - 1/19/2007

You need to add a few "using" statements to the top of your subclassed control:

using MicroFour.StrataFrame.UI;
using MicroFour.StrataFrame.UI.Windows.Forms;
using System.Drawing;
using System.Windows.Forms;

By StrataFrame Team - 6/22/2007

OK, for everyone having a problem with subclassing a control & killing VS when you drop it on a form, we've fixed the problem.  It only happened on controls that were ILocalizable because the LocalizationDesigner got itself into a loop while trying to get the designer actions for the control.  Took us a while to figure out where it was failing, but it's working now, so you'll need the latest version of the Extensiblity DLL in your GAC.  I've also included the 4 Core DLLs because they are versioned with this extensibility DLL.