[Mono-dev] How to access XplatUI for custom controls?

Miguel de Icaza miguel at novell.com
Sun Oct 31 16:22:20 EDT 2010


Hello Lionel,

    I could not get your assembly to build with the following errors:

MonoNativeCalls.cs(544,45): error CS0122: `System.Windows.Forms.MSG' is
inaccessible due to its protection level

    In addition, it seems like the code in "XplatUI\ Custom.cs" calls
itself, so this would just end up with stack overflows.    I did not find
any reference to XplaUIWin32 either.

    I rather include the code from ../System.Windows.Forms/* with a
namespace change if needed than duplicate that code.   I did that for your
structs (you can see the changes on the 2.8 and master branches) by using
the PUBLIC_TYPES define.

Miguel
On Fri, Oct 22, 2010 at 12:08 PM, Lionel Cuir <lionel_email at aulofee.com>wrote:

>  Hello,
>
> So here is it. I called the assembly Mono.WinformsSupport.dll. Rename it as
> you want + change the reference to the signing key to build it.
>
> I've done something just a little more elaborate, as it can be used on Mono
> but also with .NET. In a word, a GUI application can now use the same system
> calls, independently of the runtime ( Mono / .NET) and of the OS (Windows,
> Linux...). Technically, if a program (compiled with Mono.WinformsSupport)
> runs on Mono, it will use XplatUI from the Mono's System.Windows.Forms dll.
> But if it runs on .NET, then it will use the internal copy of XplatUIWin32
> located in Mono.WinformsSupport.
>
> I didn't include any unit test as methods are either simple stubs (calling
> XplatUI when on Mono) or a true copy of XplatUIWin32 (which is already
> tested). Apply the diff on
> mcs/class/Managed.Windows.Forms/Assembly/AssemblyInfo.cs also (add a
> InternalsVisibleTo attribute to System.Windows.Forms.dll).
>
> Hope it will encourage those creating GUI controls to make their controls
> compatible with Mono.
>
> Regards
> Lionel
>
>  ------------------------------
>  *De :* miguel.novell at gmail.com [mailto:miguel.novell at gmail.com] *De la
> part de* Miguel de Icaza
> *Envoyé :* vendredi 15 octobre 2010 17:32
> *À :* Lionel Cuir; mono-devel
>
> *Objet :* Re: [Mono-dev] How to access XplatUI for custom controls?
>
> Hello,
>
>   Right now, I'm using only a very limited subset:
>> GetFocus,
>> ResetMouseHover
>> ScrollWindow
>>
>> So obviously, I could manage it manually. But I was thinking about porting
>> various opensource controls, available on Internet and which uses
>> GUI-related win32 calls (such as the ecellent DockPanel). As a lot of work
>> has been within XplatUI and its "drivers", I was looking at reusing them. My
>> first idea was to ask about making all/some XplatUI's methods public. But
>> maybe the easier way is to extract what's needed from these classes (easier
>> but not smarter way though).
>>
>
> I would support having an extra library "WinformsSupport.dll" that exposes
> those methods for you.   Interested in cooking the patch?
>
> It would probably be a matter of making the [InternalsVisisbleTo:] the new
> assembly, and then exposing public methods for it.
>
> Miguel.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20101031/6b9d7da4/attachment.html 


More information about the Mono-devel-list mailing list