Douglas S. Blank | 2 Jun 2007 04:11
Picon
Gravatar

Windows.Forms under IronPython

New user of mono through IronPython just joining the mailing list. I've
read some of the getting started docs with mono and winforms, and looked
over what has been implemented, but didn't an answer to the following
problem. I'm running mono on Linux out of CVS with latest FePy:

% mono -V
Mono JIT compiler version 1.2.4 (/trunk/ r78467)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Architecture:  x86
        Disabled:      none
% mono ipy.exe
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import clr
>>> clr.AddReference("System.Windows.Forms")
>>> from System.Windows.Forms import Application, Form
>>> f = Form()
>>> Application.Run(f)
type: 10 Not implemented
Traceback (most recent call last):
  File System.Windows.Forms, line unknown, in Run
  File System.Windows.Forms, line unknown, in RunLoop
  File System.Windows.Forms, line unknown, in set_Visible
  File System.Windows.Forms, line unknown, in SetVisibleCore
  File System.Windows.Forms, line unknown, in SetVisibleCore
  File System.Windows.Forms, line unknown, in CreateControl
  File System.Windows.Forms, line unknown, in CreateHandle
(Continue reading)

Jonathan Chambers | 4 Jun 2007 18:05
Picon
Gravatar

Re: Windows.Forms under IronPython

Doug,
     Do you have the latest libgdiplus as well (same level as mono in svn)? It needs to match your System.Drawing version.

Thanks,
Jonathan

On 6/1/07, Douglas S. Blank <dblank <at> cs.brynmawr.edu> wrote:
New user of mono through IronPython just joining the mailing list. I've
read some of the getting started docs with mono and winforms, and looked
over what has been implemented, but didn't an answer to the following
problem. I'm running mono on Linux out of CVS with latest FePy:

% mono -V
Mono JIT compiler version 1.2.4 (/trunk/ r78467)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Architecture:  x86
        Disabled:      none
% mono ipy.exe
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import clr
>>> clr.AddReference("System.Windows.Forms")
>>> from System.Windows.Forms import Application, Form
>>> f = Form()
>>> Application.Run(f)
type: 10 Not implemented
Traceback (most recent call last):
  File System.Windows.Forms, line unknown, in Run
  File System.Windows.Forms, line unknown, in RunLoop
  File System.Windows.Forms, line unknown, in set_Visible
  File System.Windows.Forms, line unknown, in SetVisibleCore
  File System.Windows.Forms, line unknown, in SetVisibleCore
  File System.Windows.Forms, line unknown, in CreateControl
  File System.Windows.Forms, line unknown, in CreateHandle
  File System.Windows.Forms, line unknown, in SetIcon
  File System.Windows.Forms, line unknown, in SetIcon
  File System.Windows.Forms, line unknown, in SetIcon
  File System.Drawing, line unknown, in ToBitmap
  File System.Drawing, line unknown, in GetInternalBitmap
  File System.Drawing, line unknown, in LoadFromStream
  File System.Drawing, line unknown, in InitFromStream
  File System.Drawing, line unknown, in CheckStatus
NotImplementedError: The requested feature is not implemented [GDI+
status: NotImplemented]

First, am I running this correctly? If so, I assume that it is that GDI+
status is not implemented. I looked over the sources, but it wasn't clear
where the problem was. Is this a known issue?

Thanks for any pointers,

-Doug

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
Douglas S. Blank | 4 Jun 2007 21:11
Picon
Gravatar

Re: Windows.Forms under IronPython

Jonathan Chambers wrote:
> Doug,
>      Do you have the latest libgdiplus as well (same level as mono in 
> svn)? It needs to match your System.Drawing version.

Thanks, that was it. It wasn't clear that this needed to be the case 
from the mono "getting started" pages.

Wow! This is great: IronPython (with graphics) running on Mono on Linux. 
It is stunning to think of the diverse groups of people that have all 
contributed work to make this possible.

(FYI, I'll be producing some code, examples, and documentation this 
summer about how to use this to control robots. For more info, see 
http://wiki.roboteducation.org/ )

Thanks again!

-Doug

> Thanks,
> Jonathan
> 
> On 6/1/07, * Douglas S. Blank* <dblank <at> cs.brynmawr.edu 
> <mailto:dblank <at> cs.brynmawr.edu>> wrote:
> 
>     New user of mono through IronPython just joining the mailing list. I've
>     read some of the getting started docs with mono and winforms, and looked
>     over what has been implemented, but didn't an answer to the following
>     problem. I'm running mono on Linux out of CVS with latest FePy:
> 
>     % mono -V
>     Mono JIT compiler version 1.2.4 (/trunk/ r78467)
>     Copyright (C) 2002-2007 Novell, Inc and Contributors.
>     www.mono-project.com <http://www.mono-project.com>
>             TLS:           __thread
>             GC:            Included Boehm (with typed GC)
>             SIGSEGV:       normal
>             Architecture:  x86
>             Disabled:      none
>     % mono ipy.exe
>     IronPython 1.1 (1.1) on .NET 2.0.50727.42
>     Copyright (c) Microsoft Corporation. All rights reserved.
>      >>> import clr
>      >>> clr.AddReference("System.Windows.Forms")
>      >>> from System.Windows.Forms import Application, Form
>      >>> f = Form()
>      >>> Application.Run(f)
>     type: 10 Not implemented
>     Traceback (most recent call last):
>       File System.Windows.Forms, line unknown, in Run
>       File System.Windows.Forms, line unknown, in RunLoop
>       File System.Windows.Forms, line unknown, in set_Visible
>       File System.Windows.Forms, line unknown, in SetVisibleCore
>       File System.Windows.Forms, line unknown, in SetVisibleCore
>       File System.Windows.Forms, line unknown, in CreateControl
>       File System.Windows.Forms, line unknown, in CreateHandle
>       File System.Windows.Forms, line unknown, in SetIcon
>       File System.Windows.Forms, line unknown, in SetIcon
>       File System.Windows.Forms, line unknown, in SetIcon
>       File System.Drawing, line unknown, in ToBitmap
>       File System.Drawing, line unknown, in GetInternalBitmap
>       File System.Drawing, line unknown, in LoadFromStream
>       File System.Drawing, line unknown, in InitFromStream
>       File System.Drawing, line unknown, in CheckStatus
>     NotImplementedError: The requested feature is not implemented [GDI+
>     status: NotImplemented]
> 
>     First, am I running this correctly? If so, I assume that it is that
>     GDI+
>     status is not implemented. I looked over the sources, but it wasn't
>     clear
>     where the problem was. Is this a known issue?
> 
>     Thanks for any pointers,
> 
>     -Doug
> 
>     _______________________________________________
>     Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
>     <mailto:Mono-winforms-list <at> lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>     <http://lists.ximian.com/mailman/listinfo/mono-winforms-list>
> 
> 

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Neil Cawse | 4 Jun 2007 22:47
Favicon

Add missing Find Method to TreeNodeCollection.

Adding some of the missing methods our application relies on.

 

Index: /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs

===================================================================

--- /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs   (revision 78512)

+++ /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs   (working copy)

<at> <at> -25,6 +25,7 <at> <at>

 

 using System;

 using System.Collections;

+using System.Collections.Generic;

 using System.ComponentModel;

 using System.Globalization;

 

<at> <at> -434,7 +435,33 <at> <at>

                      nodes = nn;

               }

 

+#if NET_2_0

+              public TreeNode[] Find (string key, bool searchAllChildren) {

+                     List<TreeNode> results = new List<TreeNode>(0);

+                     Find (key, searchAllChildren, this, results);

+                     return results.ToArray();            

+              }

              

+              private static void Find (string key, bool searchAllChildren, TreeNodeCollection nodes, List<TreeNode> results) {

+                     for (int i = 0; i < nodes.Count; i++) {

+                            TreeNode thisNode = nodes[i];

+                            if (string.Compare(thisNode.Name, key, true, CultureInfo.InvariantCulture) == 0) {

+                                   results.Add(thisNode);

+                            }

+                     }

+                     // Need to match the Microsoft order.

+                     if (searchAllChildren) {

+                            for (int i = 0; i < nodes.Count; i++) {

+                                   TreeNodeCollection childNodes = nodes[i].Nodes;

+                                   if (childNodes.Count > 0) {

+                                          Find(key, searchAllChildren, childNodes, results);

+                                   }

+                            }

+                     }

+              }

+#endif

+

+             

               internal class TreeNodeEnumerator : IEnumerator {

 

                      private TreeNodeCollection collection;

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
Miguel de Icaza | 5 Jun 2007 23:19

Re: Add missing Find Method to TreeNodeCollection.

Hello Neil,

    Your patch was reformatted by your mail program, could you resend as
an attachment?

Miguel.

> Adding some of the missing methods our application relies on.
> 
>  
> 
> Index: /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
> 
> ===================================================================
> 
> ---
/home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
  (revision 78512)
> 
> +++
/home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
  (working copy)
> 
>  <at>  <at>  -25,6 +25,7  <at>  <at> 
> 
>  
> 
>  using System;
> 
>  using System.Collections;
> 
> +using System.Collections.Generic;
> 
>  using System.ComponentModel;
> 
>  using System.Globalization;
> 
>  
> 
>  <at>  <at>  -434,7 +435,33  <at>  <at> 
> 
>                       nodes = nn;
> 
>                }
> 
>  
> 
> +#if NET_2_0
> 
> +              public TreeNode[] Find (string key, bool
> searchAllChildren) {
> 
> +                     List<TreeNode> results = new List<TreeNode>(0);
> 
> +                     Find (key, searchAllChildren, this, results);
> 
> +                     return results.ToArray();             
> 
> +              }
> 
>                
> 
> +              private static void Find (string key, bool
> searchAllChildren, TreeNodeCollection nodes, List<TreeNode> results) {
> 
> +                     for (int i = 0; i < nodes.Count; i++) {
> 
> +                            TreeNode thisNode = nodes[i];
> 
> +                            if (string.Compare(thisNode.Name, key,
> true, CultureInfo.InvariantCulture) == 0) {
> 
> +                                   results.Add(thisNode);
> 
> +                            }
> 
> +                     }
> 
> +                     // Need to match the Microsoft order.
> 
> +                     if (searchAllChildren) {
> 
> +                            for (int i = 0; i < nodes.Count; i++) {
> 
> +                                   TreeNodeCollection childNodes =
> nodes[i].Nodes;
> 
> +                                   if (childNodes.Count > 0) {
> 
> +                                          Find(key,
> searchAllChildren, childNodes, results);
> 
> +                                   }
> 
> +                            }
> 
> +                     }
> 
> +              }
> 
> +#endif
> 
> +
> 
> +              
> 
>                internal class TreeNodeEnumerator : IEnumerator {
> 
>  
> 
>                       private TreeNodeCollection collection;
> 
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Neil Cawse | 6 Jun 2007 04:08
Favicon

Re: Add missing Find Method to TreeNodeCollection.

Here we go.
Attachment (TreeNodeCollection.patch): application/octet-stream, 2126 bytes
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
Miguel de Icaza | 6 Jun 2007 06:59

Re: Add missing Find Method to TreeNodeCollection.

Hello,

> Here we go.

I applied a few small changes and its on SVN.

(using System.Generic... needed protection)

Miguel.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Neil Cawse | 6 Jun 2007 19:27
Favicon

Patch for SplitContainer

A databinding error was occurring in our app because a Splitter higher up in the parent hierarchy was returning a null BindingContext.

The splitter panel should be relying on the base class implementation and simply change the attribute as per patch.

 

Index: /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs

===================================================================

--- /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs       (revision 78604)

+++ /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs       (working copy)

<at> <at> -48,7 +48,6 <at> <at>

               private int splitter_width;

               private int splitter_increment;

               private Orientation orientation;

-              private bool binding_context_set;

 

               private SplitterPanel panel1;

               private bool panel1_collapsed;

<at> <at> -137,8 +136,7 <at> <at>

                      panel2_collapsed = false;

                      panel1_min_size = 25;

                      panel2_min_size = 25;

-                     binding_context_set = false;

-

+                    

                      panel1 = new SplitterPanel (this);

                      panel2 = new SplitterPanel (this);

                      splitter = new Splitter ();

<at> <at> -229,11 +227,8 <at> <at>

 

               [Browsable (false)]

               public override BindingContext BindingContext {

-                     get { return binding_context_set ? base.BindingContext : null; }

-                     set {

-                            binding_context_set = true;

-                            base.BindingContext = value;

-                     }

+                     get { return base.BindingContext; }

+                     set { base.BindingContext = value; }

               }

 

               // MSDN says default is Fixed3D, creating a new SplitContainer says otherwise.

Attachment (SplitContainer.patch): application/octet-stream, 1708 bytes
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
Jonathan Pobst | 6 Jun 2007 19:50
Gravatar

Re: Patch for SplitContainer

Applied in r78773.  Thanks for the patch!

Jon

Neil Cawse wrote:
> A databinding error was occurring in our app because a Splitter higher 
> up in the parent hierarchy was returning a null BindingContext.
> 
> The splitter panel should be relying on the base class implementation 
> and simply change the attribute as per patch.
> 
>  
> 
> Index: 
> /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs
> 
> ===================================================================
> 
> --- 
>
/home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs

> (revision 78604)
> 
> +++ 
>
/home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs

> (working copy)
> 
>  <at>  <at>  -48,7 +48,6  <at>  <at> 
> 
>                private int splitter_width;
> 
>                private int splitter_increment;
> 
>                private Orientation orientation;
> 
> -              private bool binding_context_set;
> 
>  
> 
>                private SplitterPanel panel1;
> 
>                private bool panel1_collapsed;
> 
>  <at>  <at>  -137,8 +136,7  <at>  <at> 
> 
>                       panel2_collapsed = false;
> 
>                       panel1_min_size = 25;
> 
>                       panel2_min_size = 25;
> 
> -                     binding_context_set = false;
> 
> -
> 
> +                    
> 
>                       panel1 = new SplitterPanel (this);
> 
>                       panel2 = new SplitterPanel (this);
> 
>                       splitter = new Splitter ();
> 
>  <at>  <at>  -229,11 +227,8  <at>  <at> 
> 
>  
> 
>                [Browsable (false)]
> 
>                public override BindingContext BindingContext {
> 
> -                     get { return binding_context_set ? 
> base.BindingContext : null; }
> 
> -                     set {
> 
> -                            binding_context_set = true;
> 
> -                            base.BindingContext = value;
> 
> -                     }
> 
> +                     get { return base.BindingContext; }
> 
> +                     set { base.BindingContext = value; }
> 
>                }
> 
>  
> 
>                // MSDN says default is Fixed3D, creating a new 
> SplitContainer says otherwise.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Ivan N. Zlatev | 6 Jun 2007 20:30
Gravatar

[Patch] ToolboxItem - Minor fixes and 2.0 updates

Please review and commit the attached patch.

--

-- 
Ivan N. Zlatev

Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
Attachment (Toolbox_Updates.patch): text/x-patch, 6188 bytes
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Gmane