[Mono-list] Mono and Automation tools

Jonathan Pobst monkey at jpobst.com
Tue Jul 24 12:54:31 EDT 2007


Currently, the way Winforms is written, there is no way to change the 
ClassName.  The name that gets used (on Windows) is:

string.Format ("Mono.WinForms.{0}.{1}", 
System.Threading.Thread.GetDomainID ().ToString (), classStyle);

where classStyle is the CreateParams.ClassStyle.

The benefit of this is that we only register a few classes with Windows, 
and reuse them quite heavily.  The downside I guess is that you can't 
set your own ClassName.

We could probably make a change so that if a ClassName is given, we 
could append it to the current naming scheme.  However, we probably 
wouldn't put class names in our controls (you would have to override the 
CreateParams in each of your controls and put a class name in).

We should be branching for 1.2.5 this week, so I don't feel comfortable 
making such a change for 1.2.5, but I could change it after that if it 
helps any.

Jonathan



Steven Schulze wrote:
> Hi all,
>  
> We are running into a problem when we try to use automation tools on an 
> app running on Mono on Windows.  Our automation tool (SilkTest) uses the 
> native Windows class for each control to determine what kind of control 
> it is (BUTTON, STATIC) etc.  On .Net, new Windows classes are registered 
> for each control type, but they are still unique enough that you can map 
> them to your own SilkTest classes.  While we can use the .Net extension 
> of SilkTest to automatically give us all the class details (methods, etc 
> of each control) we obviously cannot use this on Mono.  because of this 
> we also don't use it when we run our app on .Net, since we want to 
> create an environment where we can seamlessly test our app on both .Net 
> and Mono.
>  
> The problem is that on Mono, all controls are registered as the same 
> class, namely "Mono.WinForms.0.40".  This gives us no way to map each 
> control type to our own SilkTest classes.  Unfortunately SilkTest is not 
> flexible in how it recognizes controls and we are stuck with using only 
> the native Windows class. 
>  
> Is there a way to specify a unique name for each control type in Mono, 
> so that the registered class for each type is unique?  I am thinking 
> something along the lines of "Mono.WinForms.0.40.MyFancyButton" or 
> something.  On .Net you can override the get method of 
> Control.CreateParams and modify the ClassName member of CreateParams, 
> which will then embed that name in the final Windows class (although you 
> need to ensure the class is registered 1st with Windows).  This can then 
> be mapped to a SilkTest class.  On Mono, the CreateParams.ClassName 
> seems to be ignored completely.
>  
> Does anyone know if there is a way to do this, other than modifying the 
> Mono source code?
>  
> Note that this is only used during automation testing on Windows using 
> ,Net and Mono, and this code will be disabled/ifdef'ed out later on.
>  
> Thanks!
> Steven
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list