How do you draw in gtkD? Simple example overriding Widget.draw() doesn't compile.

Enjoys Math via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 26 17:54:53 PST 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'?		




More information about the Digitalmars-d-learn mailing list