[Gtk-sharp-list] GTK# Code Structure

Andy Selvig ajselvig at gmail.com
Fri May 15 19:10:35 EDT 2009


Without knowing exactly what sort of code structure you're doing or what GUI
toolkit you're using, it's difficult to give an exact answer. Basically,
though, the Gtk# controls behave much like WinForms controls. That is, in
the view you create controls, place them on screen, and attach handlers for
their interaction events. The placement is different (better) in that it's
using dynamic containers instead of statically specifying their coordinates.

As for MVP, I briefly read over the Wikipedia article but don't have a firm
idea of what differentiates a Controller from a Presenter. But, it seems
like the concept applies just as well to Gtk#. You can make your view (a
Window or custom control) implement some interface that the presenter
expects, then tie have your view tie it's interaction events to handlers in
the presenter. In fact, assuming that your model and presenter code don't
contain anything specific to WinForms, it should be fairly straightforward
to use the same model/presenter code with a new Gtk# view. The primary
project that I'm working on uses this method (I call it a controller, but
same idea), with the same controller working with a WPF view on Windows and
a Gtk# view on Linux.

Also keep in mind that Mono provides a full implementation of WinForms,
although folks on this list will generally prefer Gtk#. If you have any more
detailed questions, we'd be glad to help.


On Fri, May 15, 2009 at 5:21 PM, Jesus Rodriguez <foxandxss at gmail.com>wrote:

> Hello there :)
> I have a little question about GTK# programming. I am a Windows developer
> using .NET. Well, I Use MVP (a MVC variation) for the code structure, that
> is, for separating the view from the business logic using an intermediate
> presenter (a kind of controller).
> How do you people make the code structure of your GTK# application?
> I remember that my GTK# was hell :P
> Thanks in advance for your help.
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20090515/b1339ea0/attachment.html 

More information about the Gtk-sharp-list mailing list