GTKD TreeView - Delete TreeView SubItem with Button?

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 20 09:09:49 PST 2015


Hello,

is it possible, to delete a selected TreeView SubItem with a 
Button-Click?

My Code currently looks like this:

import gtk.MainWindow;
import gtk.Box;
import gtk.Main;

import gtk.Button;
import gdk.Event;
import gtk.Widget;

import List, Languages;

void main(string[] args){
	Main.init(args);
	MainWindow win = new MainWindow("TreeView Example");
	win.setDefaultSize(500,300);

	Box box = new Box(Orientation.VERTICAL, 0);

	auto list =  new List();
	auto german = list.addCountry("German", "Germany");
	auto city = list.addCountryCity(german, "German", "Munich");

	auto sweden = list.addCountry("Swedish", "Sweden");
	auto cit = list.addCountryCity(sweden, "Swedish", "Stockholm");

	auto treeView = new LanguageTree(list);
	box.packStart(treeView, true, true, 0);

	auto btn_Delete = new Button("Delete");
	box.add(btn_Delete);

	win.add(box);
	win.showAll();
	Main.run();
}

class DeleteButton : Button
{
	this(in string text)
	{
		super(text);
		addOnButtonRelease(&del);
	}
	private bool del(Event event, Widget widget)
	{
		return true;
	}

}

But i neither know how i get the currently selected item nor how 
i could delete it within the "del"-Event of the "DeleteButton"?


More information about the Digitalmars-d-learn mailing list