[Gtk-sharp-list] Stuck in gtk-demo port from c to c#

Miguel de Icaza miguel@ximian.com
01 Oct 2003 13:43:07 -0400


> DemoButtonBox.cs: Finished 100%
> ===============================
> Allmost exactly the same example.
> Couldn't find a equivalent for gtk_main() thus I used Application.Init()
> I used the prefix Gtk, in window because of ambiguous reference (Gtk.Window or Gdk.Window) 
> I used the prefix Gtk, with the casting of buttons because of bug in mcs compiler
> 		Gtk.ButtonBox bbox = null;
> 		if (horizontal == true){
> 			bbox =  new Gtk.HButtonBox();
> 		}
> 		else {
> 			bbox =  new Gtk.VButtonBox(); 
> 		}

Use Application.Run () for gtk_main.   What is the bug in the MCS

> DemoColorSelection.cs: Almost finished 95%
> ==========================================
> I could not write ExposeEventCallback.
> How the hell can I translate gdk_draw_rectangle !!!
> I initialized color to Gtk.Color.Zero couldn't find NULL equivalent in c-sharp.

Can you show us the original code?   gdk_draw_rectangle is a drawable
method in Gdk#

	drawable.DrawRectangle (...)
> DemoDrawingArea.cs: just interface done, no callbacks implemented 50%
> =======================================================================
> I'm lost handling colors, events, drawingareas, you name it, I don't know it
> :-(

Look at the way colors are allocated in the sample for T:Gdk.Colormap in

> ItemFactory.cs: Nothing done, stuck at the beginning. -3.14%
> ============================================================
> OUCH, it really hurts when you can't get past the third line of code

What is the issue?

> DemoPanes.cs:  just interface done, no callbacks implemented 80%
> =================================================================
> Guess what ?
> I Got stuck in the callbacks, :-)
> My question is plain and simple :
> If I have two widgets that call the same callback, how can I find out 
> the name of the widget that invoked the callback ???

The event handler receives an `object' argument, use this to know what
the source of the emission was. 

> DemoMain.cs 5%
> ==============
> Should I use reflection to get the properties out of the examples, or should
> I do it by hand like in this examples ?

Doing it by hand is fine.