Thread overview
How do you draw in gtkD? Simple example overriding Widget.draw() doesn't compile.
Jan 27, 2016
Enjoys Math
Jan 27, 2016
Enjoys Math
Jan 27, 2016
Gerald
January 27, 2016
import gtk.MainWindow;
import gtk.Main;
import gtk.DrawingArea;
import cairo.Context;
import std.stdio;

void main(string[] args) {
    Main.init(args);
    auto win = new MainWindow("Hello World");
    win.setDefaultSize(200, 100);
    win.add(new MyDrawingArea());
    win.showAll();
    Main.run();
}

class MyDrawingArea : DrawingArea {
	override bool draw(Context cairo) {
		writeln("Hello");
		return true;
	}
}

Error:
Error: function main.MyDrawingArea.draw does not override any function, did you mean to override 'gtk.Widget.Widget.draw'?		


January 27, 2016
On Wednesday, 27 January 2016 at 01:54:53 UTC, Enjoys Math wrote:
> import gtk.MainWindow;
> import gtk.Main;
> import gtk.DrawingArea;
> import cairo.Context;
> import std.stdio;
>
> void main(string[] args) {
>     Main.init(args);
>     auto win = new MainWindow("Hello World");
>     win.setDefaultSize(200, 100);
>     win.add(new MyDrawingArea());
>     win.showAll();
>     Main.run();
> }
>
> class MyDrawingArea : DrawingArea {
> 	override bool draw(Context cairo) {
> 		writeln("Hello");
> 		return true;
> 	}
> }
>
> Error:
> Error: function main.MyDrawingArea.draw does not override any function, did you mean to override 'gtk.Widget.Widget.draw'?

Oh i see, there are examples under the GDk directory under 'demos'.
January 27, 2016
Generally don't override methods in GtkD, use event handlers like addOnDraw. Because GtkD wraps GTK functions an overriden D method of GtkD will never get called by GTK since it is working with the underlying C functions directly.