Simple Tutorial

2 views
Skip to first unread message

Leauki

unread,
Dec 20, 2007, 4:57:53 AM12/20/07
to cocoa-sharp-dev
http://code.google.com/p/cocoa-sharp-dev/wiki/SimpleTutorial

I ran into two problems.

"12. Ctrl Click and drag from "File's Owner" to
"ApplicationController", connect to the "delegate" Outlet."

I cannot clock and drag the connection, my ApplicationController
object doesn't have a "delegate" outlet. This is with Xcode 3 in
Leopard.

Also, when I tried to compile the program, the compiler said it
couldn't find the Apple.* namespaces. I installed Mono 1.2.6, I
thought Cocoa# was part of it?

Leauki

unread,
Dec 26, 2007, 5:06:41 PM12/26/07
to cocoa-sharp-dev
I got the even simpler tutorial working. I have a window titled "Hello
World" and it is a .NET program all right.

But the SimpleTutorial still doesn't work, and I cannot connect
buttons or textfields to anything.

Any ideas?

(Anybody listening?)

Leauki

unread,
Dec 29, 2007, 3:56:03 PM12/29/07
to cocoa-sharp-dev
Somebody posted the solution to the mono-osx mailing list:

"Unfortunately, this tutorial is WAY outdated. The namespace is now
simply called "Cocoa", also, the NS prefix has been dropped from all
classes, so it's "Button", instead of "NSButton" etc. (ftr, this last
is
a change that i personally think was a mistake)."

I will try it out tomorrow.

Manuel de la Pena

unread,
Dec 30, 2007, 5:21:33 PM12/30/07
to cocoa-s...@googlegroups.com
Sounds interesting, I have decided to check the ObjCSharp tree and
have decided to try and write some documentation about it, it should
be useful since it is the system that provides the bridges, I have
also gotten the Cocoa# code from the svn and I'm going through it.

Chuck Esterbrook

unread,
Dec 30, 2007, 5:29:56 PM12/30/07
to cocoa-s...@googlegroups.com
Will you be posting the documentation somewhere like a wiki?

Manuel de la Pena

unread,
Dec 30, 2007, 5:46:31 PM12/30/07
to cocoa-s...@googlegroups.com
YES, I'd love to post is some where, and as soon as I've got it I'll
post an message here and I'll ask where would be the appropriate
location. Some proof reading will be great!!!!

Leauki

unread,
Dec 31, 2007, 6:18:01 AM12/31/07
to cocoa-sharp-dev
BTW, I tried it and it seems like none of the methods of NSTextField
(aka TextField) work.

The compiler complained about that.

I can do proofreading.

Manuel de la Pena

unread,
Dec 31, 2007, 8:06:20 AM12/31/07
to cocoa-s...@googlegroups.com
I have been doing some reading and I think I can write a couple of tutorials
about ObjCSharp that will be useful, specially for possible developers. I
have an old copy of "Cocoa with ObjectiveC" from O'reilly which has a couple
of simple tutorials with objective c I could borrow ideas from. My plans are
the following:

1. Create a project that has an Aqua UI with the XCode tools and write the
Controller with Objectcsharp, that is, the GUI uses Aqua and we write the
rest of the code in C#. This tutorial will show how to create a GUI using
the XCode tools and do the binding to the "core" of the app done in C#.
2. Create a non-GUI project in C# that accesses Cocoa libs, I'm thinking of
using the AddressBook framework to show how to access it from C#... this way
we will so how to do the bridges between Coca to (->) C#, which is what we
should do when developing the Cococa bindings for .Net.

Both projects are very simple but will show the bridges between the
languages, once I have done them and made sure they work I'll write a step
by step guide of how to repreduce them.

Any thoughts??? Does anyone think I should try to do more complicated
things.?Both examples try to show how to use objectcsharp which is the basis
to develope the Cocoa# project.

Please let me know, I think I'll be able to post both examples in a day or
two, everything depens on how anoying is the family during the holidays ;) ,

Manuel
----- Original Message ----
-
From: "Leauki" <ajb...@gmail.com>
To: "cocoa-sharp-dev" <cocoa-s...@googlegroups.com>
Sent: Monday, December 31, 2007 12:18 PM
Subject: Re: Simple Tutorial

Leauki

unread,
Dec 31, 2007, 8:28:09 AM12/31/07
to cocoa-sharp-dev
On Dec 31, 1:06 pm, "Manuel de la Pena" <eti...@gmail.com> wrote:
> I have been doing some reading and I think I can write a couple of tutorials
> about ObjCSharp that will be useful, specially for possible developers.

Excellent!

> I have an old copy of "Cocoa with ObjectiveC" from O'reilly which has a couple
> of simple tutorials with objective c I could borrow ideas from. My plans are
> the following:

I have that book too, I think. Does it have a dog (Labrador?) on it?

> 1. Create a project that has an Aqua UI with the XCode tools and write the
> Controller with Objectcsharp, that is, the GUI uses Aqua and we write the
> rest of the code in C#. This tutorial will show how to create a GUI using
> the XCode tools and do the binding to the "core" of the app done in C#.

Can we get the plug-in to work with Xcode 3?

Otherwise that sounds like a useful tutorial.

> 2. Create a non-GUI project in C# that accesses Cocoa libs, I'm thinking of
> using the AddressBook framework to show how to access it from C#... this way
> we will so how to do the bridges between Coca to (->) C#, which is what we
> should do when developing the Cococa bindings for .Net.

Excellent idea, especially since that would allow for some very
interesting stuff, like syncing the Mac address with Linux etc..

> Both projects are very simple but will show the bridges between the
> languages, once I have done them and made sure they work I'll write a step
> by step guide of how to reproduce them.

Thank you for all your work!

I am definitely looking forward to trying out everything. My own
experiments have given me an idea of how Cocoa is used from C#.

One point though: Make sure that you strictly use a Model-View-
Controller pattern for the GUI tutorial. I think Cocoa# users will be
mostly .NET people and not Objective C switches, which means that
their goal is likely compatibility with Windows (and possibly Linux).
And MVC makes sure that the GUI can be replaced easily.

I am thinking one Model in C# for all platforms and then a Controller
in C# adapted as glue between the Model and the GUI, which can be
Winforms or WPF (for Windows), GTK# (for Linux), or Cocoa# (for Mac
OS).

I will definitely rewrite any tutorial I go through and any project I
work on to work with Winforms as well.

(Would it be possibly to put that all in one assembly, i.e. the code
checks the platform and loads the NIB if necessary and doesn't use the
Winforms GUI? I'll see what I can figure out.)

> Any thoughts??? Does anyone think I should try to do more complicated
> things?

No, definitely not. Keep it simple.

> Both examples try to show how to use objectcsharp which is the basis
> to develope the Cocoa# project.

Yepp.

> Please let me know, I think I'll be able to post both examples in a day or
> two, everything depens on how anoying is the family during the holidays ;) ,

Very good.

Tell me what you need/want me to do. I told you (via email) what I
cannot do and why, but I can test and write documentation/manuals and
check that porting to and from Winforms works and how.

Once I get Cocoa# to work, I'll post a tutorial about how to develop a
Winforms app (in Visual Studio) and then port it to Cocoa# (in Xcode).
I don't know anything about GTK#, but maybe we can find somebody to
cover that as well!

Jouni Miikki

unread,
Dec 31, 2007, 10:24:41 AM12/31/07
to cocoa-s...@googlegroups.com
That would be so nice. I think those two example projects can make a huge
difference on new people who are trying c#, mono and cocoa combination.

Keep those first few examples simple and then move to more advanced :).

Br,
Jouni

Manuel de la Pena

unread,
Dec 31, 2007, 10:39:01 AM12/31/07
to cocoa-s...@googlegroups.com
It seems that everyone is happy with those two first examples, I'm going to
start doing them and will jot down all the important stuff. I will focus on
the Model-View-Controller and will make very clear the division between the
c# code and the Objective C code. My first approach is doing everything with
the normal XCode 3.0 installation and will try to adapt the plugin later on.
As soon as I have something redeable I'll post it here.

PD: Leauki, the book has a labrador.. we probably have the same one... it is
a good init bopok and i really like the examples which I will ty to adapt to
use objecticsharp

Leauki

unread,
Dec 31, 2007, 11:40:28 AM12/31/07
to cocoa-sharp-dev
On Dec 31, 3:39 pm, "Manuel de la Pena" <eti...@gmail.com> wrote:

>
> PD: Leauki, the book has a labrador.. we probably have the same one... it is
> a good init book and i really like the examples which I will ty to adapt to
> use objecticsharp
>

I use "Cocoa Programming for Mac OS X" by Aaron Hillegass now. I find
it easier and more complete than the dog book. There is also a video
podcast around the book at http://www.cocoacast.com/. I recommend that
everyone not experienced in Cocoa and Objective C take a look at the
podcast!

I will also update the CocoaCast forums on whatever news we might have
regarding Cocoa#.

Good luck with the examples!

Manuel de la Pena

unread,
Jan 2, 2008, 4:08:34 AM1/2/08
to cocoa-s...@googlegroups.com

This is just a quick update about the tutorials I'm writing.

I have written the app that is going to be used as guide for the very
first tutorial,, the app consists in a "virtual library" that allows
to organize a book collection. The core of the app is done with C#
using ADO.Net with SQLite while the GUI uses Cocoa. I think is a good
example of how to use ObjectiveCSharp... I have started writing the
tutorial and I'm half way through, I'll post here the complete thing
hopefully tonight.

On 29/12/2007, at 21:56, Leauki wrote:

Leauki

unread,
Jan 2, 2008, 4:36:55 AM1/2/08
to cocoa-sharp-dev
I hope it's not too complicated. :-(

What do we need for a backend? MS SQLServer? Or is there something we
can use on the Mac side (like MySQL)?

Looking forward to it.

Leauki

unread,
Jan 2, 2008, 4:38:03 AM1/2/08
to cocoa-sharp-dev
What happened to the simply Cocoa tutorial from the book?

Manuel de la Pena

unread,
Jan 2, 2008, 5:05:50 AM1/2/08
to cocoa-s...@googlegroups.com
I followed one of the books examples but there were two reasons why I
did not wanted to use the exact same one of the book:

Copyrights.... yes I know, they are a pain in the ass, but I do not
want anyone saying I copied the examples and get into trouble.

The code in the book tried to explain the use of Cocoa but in this
first tutorial I wanted to show how to do the bridges between ObjectC
and C#.

The storage is done using SQLite 3 which comes with the basic
installation of Mac OS X... any way the C# code that stores the book
info is 500 lines long, is very simple, if not it can always be
changed :)

Reply all
Reply to author
Forward
0 new messages