picoe / eto Goto Github PK
View Code? Open in Web Editor NEWCross platform GUI framework for desktop and mobile applications in .NET
License: Other
Cross platform GUI framework for desktop and mobile applications in .NET
License: Other
Unfortunately, the tutorials from git don't work for me.
Either an error message pops up saying that the platform could not be detected, or the program simply quits without ever showing a gui.
Could you please provide a step by step guide for MacOS X with Monodevelop 3.0 or at least provide a working tutorial.
http://screencast.com/t/oBKAXAUIq
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows) {
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MyTreeGridItem : TreeGridItem
{
String fcaption;
public Icon MyImage { get; set; }
public String MyCaption { get {if (this.Expanded) {return fcaption+" [Expanded]";} else {return fcaption;}} set {fcaption = value;} }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5,5 };
TreeGridView tv;
TreeGridItem it;
Icon ic;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyImage = ic, MyCaption = lName };
lItem.Expanded = aLevel == 0;
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
lRoot.Expanded = true;
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
// black.ico is added into project as "Embedded resource"
ic = Icon.FromResource("DocsEditor.black.ico");
Size = new Size(500, 600);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "check expanded" };
lPanelLayout.Add(btn, 0, 0, false, false);
btn.Click += (sender, e) => { if (tv.SelectedItem != null) { MessageBox.Show("Expanded = " + tv.SelectedItem.Expanded.ToString()); } };
fMainSplitter.Position = 250;
CreateTree();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows) {
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MyTreeGridItem : TreeGridItem
{
public Icon MyImage { get; set; }
public String MyCaption { get; set; }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5,5 };
TreeGridView tv;
TreeGridItem it;
Icon ic;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyImage = ic, MyCaption = lName };
lItem.Expanded = aLevel == 0;
if (lName == "[3]Name202") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
lRoot.Expanded = true;
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
// black.ico is added into project as "Embedded resource"
ic = Icon.FromResource("DocsEditor.black.ico");
Size = new Size(500, 600);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "Set SelectedItem" };
lPanelLayout.Add(btn, 0, 0, false, false);
btn.Click += (sender, e) => { tv.SelectedItem = it; };
fMainSplitter.Position = 250;
CreateTree();
}
}
}
public class Icon : Image
{
..
public static Icon FromResource (Assembly asm, string resourceName)
{
if (asm == null)
asm = Assembly.GetCallingAssembly ();
using (var stream = Resources.GetResource (resourceName, asm)) {
return new Icon (stream);
}
}
try ro move splitter: combobox isn't resized correctly
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows) {
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
ComboBox cb;
public MainForm()
{
Size = new Size(500, 200);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
fMainSplitter.BackgroundColor = Colors.Gray;
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
cb = new ComboBox();
cb.Items.Add("1");
cb.Items.Add("2");
cb.Items.Add("3");
cb.SelectedIndex =0;
lPanelLayout.Add(cb, 0, 0, true, false);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
fMainSplitter.Position = 100;
}
}
}
Using the code below creates a tree like:
http://i.imgur.com/2P7XL.png
which has level1 and level2 items between level3 (which shouldn't be possible with this logic)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
TreeGridView tv;
TreeGridItem CreateTree()
{
Random rv = new Random();
TreeGridItem res = new TreeGridItem("root");
for (int i = 0; i < 1000; i++)
{
var item = new TreeGridItem( "level1_"+i);
item.Expanded = true;
res.Children.Add(item);
for (int j = 0; j < 15; j++)
{
var lItem = new TreeGridItem(Enumerable.Range(0, rv.Next(0, 100)).Select(a => new TreeGridItem("level3_" + a)), "level2_" + j);
item.Children.Add(lItem);
lItem.Expanded = true;
}
}
return res;
}
public MainForm()
{
this.Title = "Test Application";
this.Style = "main";
this.ClientSize = new Size(900, 650);
tv = new TreeGridView();
var col = new GridColumn { DataCell = new TextBoxCell(0) };
tv.Columns.Add(col);
this.AddDockedControl(tv);
var tree = CreateTree();
tv.DataStore = tree;
tv.Expanding += Expanding;
}
int expanding;
void Expanding(object o, EventArgs e)
{
expanding++;
Title = "Expanded " + expanding;
}
}
}
http://screencast.com/t/au5x2iGOq1w
2 problems:
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
testcase is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows)
{
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5, 5 };
TreeGridView tv;
TreeGridItem it;
public Icon ic, ic1;
public Boolean lstate;
public class MyTreeGridItem : TreeGridItem
{
public Icon MyImage { get
{
if ((Application.Instance.MainForm as MainForm).lstate)
{ return (Application.Instance.MainForm as MainForm).ic; }
else
{ return (Application.Instance.MainForm as MainForm).ic1; }
}
}
public String MyCaption { get; set; }
}
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyCaption = lName };
lItem.Expanded = aLevel == 0;
if (lName == "[2]Name20") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
lRoot.Expanded = true;
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
// icos are added into project as "Embedded resource"
ic = Icon.FromResource("DocsEditor.black.ico");
ic1 = Icon.FromResource("DocsEditor.green.ico");
Size = new Size(500, 600);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "Set SelectedItem" };
lPanelLayout.Add(btn, 0, 0, false, false);
btn.Click += (sender, e) => {
lstate = !lstate;
tv.Focus();
(tv.SelectedItem as MyTreeGridItem).MyCaption = (tv.SelectedItem as MyTreeGridItem).MyCaption + '*';
tv.Invalidate();
};
fMainSplitter.Position = 250;
CreateTree();
tv.SelectedItem = it;
}
}
}
Currently I'm trying to add a textbox (searchbox like in many other MacOS X apps) to the toolbar. So far I haven't managed to do so.
Additionally, it would be nice to the be able to set the style (e.g. rounded corners for textboxes, button look for toolbar buttons etc)
It would be great if the tab pages could support a "close button" and ways to deal with closing tabs with it; this would be a very nice base for a tabbed MDI interface written with Eto.
Should use Mono for Android or wait for Xamarin's version when released. Probably will be very compatible with each other so work would not be wasted as such.
A first chance exception of type 'System.Reflection.TargetException' occurred in mscorlib.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in System.dll
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.dll
Additional information: Property accessor 'MyImage' on object 'etotest.MyTreeGridItem' threw the following exception:'Object does not match target type.'
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows) {
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MyTreeGridItem : TreeGridItem
{
public virtual Icon MyImage { get; set; }
public String MyCaption { get; set; }
}
public class MyTreeGridItem1 : MyTreeGridItem
{
public override Icon MyImage { get; set; }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5 };
TreeGridView tv;
TreeGridItem it;
Icon ic;
void CreateItem1(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyImage = ic, MyCaption = lName };
lItem.Expanded = false;
aParent.Children.Add(lItem);
}
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem1 { MyImage = ic, MyCaption = lName };
lItem.Expanded = true;
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem1(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
lRoot.Expanded = true;
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
// black.ico is added into project as "Embedded resource"
ic = Icon.FromResource("DocsEditor.black.ico");
Size = new Size(350, 600);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "create tree" };
lPanelLayout.Add(btn, 0, 0, false, false);
btn.Click += (sender, e) => { CreateTree(); };
fMainSplitter.Position = 150;
}
}
}
testcase:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5 };
TreeGridView tv;
TreeGridItem it;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new TreeGridItem(lName);
lItem.Expanded = true;
if (lName == "[2]Name12") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
Size = new Size(900, 800);
var lp = new Panel();
this.AddDockedControl(lp, new Padding(5));
var lPanelLayout = new TableLayout(lp, 1, 2);
lPanelLayout.Padding = new Padding(0);
var lButton = new Button();
lButton.Text = "Select Item";
lButton.Click += but_Click;
lPanelLayout.Add(lButton, 0, 0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new TextBoxCell(0) });
lPanelLayout.Add(tv, 0, 1, true, true);
CreateTree();
}
void but_Click(object sender, EventArgs e)
{
MessageBox.Show( "'"+it.Values[0]+"' item should be selected");
tv.SelectedItem = it;
}
}
}
When executing the following code, while the Generator
is set to Eto.Platform.Wpf
text does not get drawn.
var Screen = new Drawable();
Screen.Paint += (sender, e) =>
{
e.Graphics.DrawRectangle(Color.Red, new Rectangle(0, 0, 320, 240));
e.Graphics.DrawText(new Font(SystemFont.Default), Color.Blue, 10, 10, "Hello World!");
};
While the Generator
is set to Eto.Platform.Windows
(I cannot test the others now) it works as expected and draws a "Hello World!" into the Drawable
.
Looking into the source code I see its commented out/not implemented.
Need some form of a DataGrid control
http://screencast.com/t/cl2IyRC3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows) {
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MyTreeGridItem : TreeGridItem
{
public Icon MyImage { get; set; }
public String MyCaption { get; set; }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5 };
TreeGridView tv;
TreeGridItem it;
Icon ic;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyImage = ic, MyCaption = lName };
lItem.Expanded = true;
if (lName == "[1]Name1") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
lRoot.Expanded = true;
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
// black.ico is added into project as "Embedded resource"
ic = Icon.FromResource("DocsEditor.black.ico");
Size = new Size(350, 600);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "create tree" };
lPanelLayout.Add(btn, 0, 0, false, false);
btn.Click += (sender, e) => { CreateTree(); };
fMainSplitter.Position = 150;
}
}
}
Should add mechanisms to support printing. Should support print dialog, and specify what to print either through a graphics context or a window of controls.
Need to ensure WebView supports printing as well through javascript.
Should provide descriptive comments for all (public facing) code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5 };
TreeGridView tv;
TreeGridItem it;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new TreeGridItem(lName);
lItem.Expanded = true;
if (lName == "[1]Name1") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
Size = new Size(900, 800);
var lp = new Panel();
this.AddDockedControl(lp, new Padding(5));
var lPanelLayout = new TableLayout(lp, 1, 2);
lPanelLayout.Padding = new Padding(0);
var lButton = new Button();
lButton.Text = "Select Item";
lButton.Click += but_Click;
lPanelLayout.Add(lButton, 0, 0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new TextBoxCell(0) });
lPanelLayout.Add(tv, 0, 1, true, true);
CreateTree();
}
void but_Click(object sender, EventArgs e)
{
MessageBox.Show( "'"+it.Values[0]+"' item will be renamed to 'test'");
it.Values[0] = "test";
tv.Invalidate();
}
}
}
Note: probably this code should work without tv.Invalidate()
NRE in TreeGridViewHandler.AttachEvent.
What bugs me a little bit about this new (and really cool!) UI toolkit is the fact, that there is no designer available.
I really like WinForms designer and to minor extent the Xcode Interface Builder.
It makes life so much easier in many cases, if you simply can drag widgets to a form and change their properties in a property panel.
I see these options:
This would greatly improve productivity
Partially written. Will require that the other Mobile-specific controls, events, etc be implemented.
The TableLayout is a little cumbersome to use, and should be much easier. Key pain point is having to know the size of the table up front and having to change it each time more controls are added.
Should perhaps have a vertical/horizontal layout as well, or make it easier to use.
Current code (as an example):
var layout = new TableLayout(this, 1, 2);
layout.Add(new MyControl(), 0, 0);
layout.Add(new MyControl(), 0, 1);
layout.Add(new MyControl(), 0, 2);
layout.Add(new MyControl(), 0, 3);
layout.Add(new MyControl(), 0, 4);
Maybe something like:
var layout = new VerticalLayout(this);
layout.Add(new MyControl());
layout.Add(new MyControl());
layout.Add(new MyControl());
layout.Add(new MyControl());
layout.Add(new MyControl());
A very welcomed addition would be the implementation of a Binding System so we can develop our Applications using fancy design patterns like Model-View-ViewModel. This would significantly increase the speed at which we could develop our UIs and also would lower the amount of code required for GUI heavy applications.
Currently the items are added to collections for drop downs, listbox, etc. These should be late bound by events or a data source object.
The API should be super simple to use.
Hi,
I just checked out Eto and tried the tutorial, but it fails to start up with this error message:
Eto.EtoException: Could not detect platform. Are you missing a platform assembly?
at Eto.Generator.get_Detect () [0x00091] in /Users/ash/Projekte/MonoDevelop/Eto/Source/Eto/Generator.cs:88
at Eto.Forms.Application..ctor () [0x00000] in :0
at Tutorial1.MainClass.Main (System.String[] args) [0x00006] in /Users/ash/Projekte/MonoDevelop/Eto/Tutorials/Tutorial1 - Hello World/Main.cs:21
I'm running MacOS X 107.4, Mono 10.9 and MonoDevelop 3.0
Gets or sets the content of the current selection in the text box.
http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.selectedtext.aspx
it works only if WPF generator is set : http://screencast.com/t/rQntzuvM0d3
and doesn't work for windows/mac generator: http://screencast.com/t/sAb8Ryd8Ix
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows)
{
//generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
generator = Generator.GetGenerator("Eto.Platform.Windows.Generator, Eto.Platform.Windows");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
public MainForm()
{
Title = "Generator = " + Generator.ID;
Size = new Size(500, 100);
var p = new Panel();
this.AddDockedControl(p, new Padding(5));
var lPanelLayout = new TableLayout(p as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "btn" };
lPanelLayout.Add(btn, 0, 0, false, false);
}
}
}
I'm not sure if you already saw this project, but you might want to have a look at it: https://github.com/slluis/xwt
Google group: http://groups.google.com/group/xwt-list/browse_thread/thread/b9f89710d54574d7
It looks like they aren't as far as you yet, but there are several active developers working on it. I think you should really contact them. Maybe you even want to contribute, one big project is always better for the community than several small ones.
GTK platform uses GDK for drawing lines, rects, etc. Drawback with this is there is not antialiasing support.
Should use Cairo for drawing for better quality drawing of primitives.
Should have sections for each type of control.
Each section should test the various modes, attributes, etc of the control.
Optionally include sections with sliders/check boxes to change options at runtime.
e.g.
fcombobox.Items.Add (new ImageListItem { Text = "Item " + list.Items.Count, Image = myImage});
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.IO;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Generator generator;
if (EtoEnvironment.Platform.IsWindows)
{
generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
}
else if (EtoEnvironment.Platform.IsMac)
{
generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
}
else
{
generator = Generator.GetGenerator("Eto.Platform.GtkSharp.Generator, Eto.Platform.Gtk");
}
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MyTreeGridItem : TreeGridItem
{
public Icon MyImage { get; set; }
public String MyCaption { get; set; }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5, 5 };
TreeGridView tv;
TreeGridItem it;
Icon ic;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyImage = ic, MyCaption = lName };
lItem.Expanded = aLevel == 0;
if (lName == "[3]Name202") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
lRoot.Expanded = true;
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
// black.ico is added into project as "Embedded resource"
ic = Icon.FromResource("DocsEditor.black.ico");
Size = new Size(500, 600);
var fMainSplitter = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1 };
this.AddDockedControl(fMainSplitter, new Padding(5));
fMainSplitter.Panel1 = new Panel();
var lPanelLayout = new TableLayout(fMainSplitter.Panel1 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
fMainSplitter.Panel2 = new Panel();
lPanelLayout = new TableLayout(fMainSplitter.Panel2 as Panel, 1, 1);
lPanelLayout.Padding = new Padding(0);
var btn = new Button { Text = "Set SelectedItem" };
lPanelLayout.Add(btn, 0, 0, false, false);
btn.Click += (sender, e) => { tv.SelectedItem = it; };
fMainSplitter.Position = 250;
CreateTree();
tv.SelectedItem = it;
}
}
}
Prompts the user to choose a font from among those installed on the local computer.
http://msdn.microsoft.com/en-us/library/system.windows.forms.fontdialog.aspx
Gets or sets a value indicating whether keyboard shortcuts are enabled within the WebBrowser control.
When loading a BMP or PNG file on windows into an image view, the correct size is displayed for both types of images. On mac, the BMP will show up as it's actual size (450px by 450px), but the PNG will show up as a samller size (337,337).
It would be nice to have the context menu for the toolbar enabled, that allows for managing (reordering, removing, adding) toolbar icons.
Ok I finally had some time to work on my current open source project and played around with the webview control. The rendering is nice and fast, the basic functions of the control are working flawlessly on OSX Lion. However the events are missing completely, so I took some time to write together the most basic features the webview control would need in order to be ready to be used.
Those would be the most basic things for the control to be ready to be used in a project, DOM interaction and things like that aren't quite as important, but basic JavaScript functionality should be possible. It might be possible to inject JavaScript by changing the URL of the browser, but I don't know in how far that works on the different platforms.
Getting this property returns the current insertion position index of the caret (see TextPointer for information on terminology like "insertion position"). Setting this property moves the caret to the specified insertion position.
An insertion position is between either characters or element tags.
http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.caretindex.aspx
Current controls should be updated to include mobile-centric events and controls.
This includes things like OnRotationChanged, Navigation Controller, etc. Need to think of a common metaphor across platforms.
Eto\Source\Eto.Test\Eto.Test.WinForms\bin\Debug\Eto.Test.WinForms.exe
[12:39:45] Sender: Eto.Forms.TreeGridView, Collapsing, Item: Eto.Forms.TreeGridItem
[12:39:45] Sender: Eto.Forms.TreeGridView, Collapsed, Item: Eto.Forms.TreeGridItem
[12:39:45] Sender: Eto.Forms.TreeGridView, SelectionChanged, Item: Eto.Forms.TreeGridItem
[12:39:45] Sender: Eto.Forms.TreeGridView, SelectionChanged, Item: Eto.Forms.TreeGridItem
windows/wpf
launch testcase and "play" with tree - expand and collapse some nodes
testcase:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public interface IMyTreeGridItem : ITreeGridItem
{
String Name { get; set; }
}
public class MyTreeGridItem : TreeGridItem, IMyTreeGridItem
{
public String Name { get; set; }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5, 5, 5 };
TreeGridView tv;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem();
lItem.Name = lName;
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new MyTreeGridItem();
CreateItem(lRoot, "Name", 0);
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
tv.Expanding += (sender, e) =>
{
(e.Item as IMyTreeGridItem).Name = "Expanded";
};
tv.Collapsing += (sender, e) =>
{
(e.Item as IMyTreeGridItem).Name = "Collapsed";
};
});
}
public MainForm()
{
Size = new Size(900, 800);
var lp = new Panel();
this.AddDockedControl(lp, new Padding(5));
var lPanelLayout = new TableLayout(lp, 1, 2);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new TextBoxCell("Name") });
lPanelLayout.Add(tv, 0, 1, true, true);
CreateTree();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
//var generator = Generator.GetGenerator("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf");
var generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MyTreeGridItem : TreeGridItem
{
public Icon MyImage { get; set; }
public String MyCaption { get; set; }
}
public class MainForm : Form
{
int[] arr = new int[] { 5, 5 };
TreeGridView tv;
TreeGridItem it;
Icon ic;
void CreateItem(TreeGridItem aParent, string aBaseName, int aLevel)
{
var lName = "[" + aLevel + "]" + aBaseName;
var lItem = new MyTreeGridItem { MyImage = ic, MyCaption = lName };
//lItem.MyImage = ic;
//lItem.MyCaption = lName;
lItem.Expanded = true;
if (lName == "[1]Name1") { it = lItem; };
aParent.Children.Add(lItem);
if (aLevel < arr.Length)
for (int i = 0; i < arr[aLevel]; i++)
CreateItem(lItem, aBaseName + i.ToString(), aLevel + 1);
}
void CreateTree()
{
TreeGridItem lRoot = new TreeGridItem();
CreateItem(lRoot, "Name", 0);
Application.Instance.Invoke(delegate
{
tv.DataStore = lRoot;
});
}
public MainForm()
{
ic = new Icon("black.ico");
Size = new Size(900, 800);
var lp = new Panel();
this.AddDockedControl(lp, new Padding(5));
var lPanelLayout = new TableLayout(lp, 1, 1);
lPanelLayout.Padding = new Padding(0);
tv = new TreeGridView();
tv.Columns.Add(new GridColumn { DataCell = new ImageTextCell("MyImage", "MyCaption") });
lPanelLayout.Add(tv, 0, 0, true, true);
CreateTree();
}
}
}
windows: http://screencast.com/t/J6joIgg613o
macosx: http://screencast.com/t/2ZAvzEW6MX
In short: is there any kind of OpenGL Render Control planned which is being used in conjunction with OpenTK?
Currently there are at least 2 similar projects that basically implement the same - a new API for the UI Cocoa components based on MonoMac.
Wouldn't it be better to merge the projects or at least share some code?
The other projects I know of are:
https://github.com/mcneel/MonoMac.Windows.Form
https://github.com/Clancey/MonoMac.Windows.Form
all tabs are put in one line
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto;
using Eto.Forms;
using Eto.Drawing;
using System.Threading;
namespace etotest
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var generator = Generator.GetGenerator("Eto.Platform.Mac.Generator, Eto.Platform.Mac");
var app = new TestApplication(generator);
app.Run(args);
}
}
public class TestApplication : Application
{
public TestApplication(Generator generator)
: base(generator)
{
this.Name = "Test Application";
}
public override void OnInitialized(EventArgs e)
{
this.MainForm = new MainForm();
HandleEvent(Application.TerminatingEvent);
base.OnInitialized(e);
// show the main form
this.MainForm.Show();
}
}
public class MainForm : Form
{
TabControl pg;
public MainForm()
{
Size = new Size(900, 800);
var lp = new Panel();
this.AddDockedControl(lp, new Padding(5));
var lPanelLayout = new TableLayout(lp, 1, 2);
lPanelLayout.Padding = new Padding(0);
pg = new TabControl();
lPanelLayout.Add(pg, 0, 1, true, true);
for (int i = 0; i < 20; i++) {
var p = new TabPage();
p.Text = "page " + i.ToString();
pg.TabPages.Add(p);
};
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.