GTKD TreeView - Delete TreeView SubItem with Button?
    TheDGuy via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Nov 20 10:57:10 PST 2015
    
    
  
Thanks for your reply,
now it gets more clear for me but how am i able to access the 
TreeView within the CustomButton-Class? If i declare TreeView and 
TreeStore public i get "static variable list cannot be read at 
compile time"?
import gtk.MainWindow;
import gtk.Box;
import gtk.Main;
import gtk.Button;
import gdk.Event;
import gtk.Widget;
import List, Languages;
auto list = new List();
auto treeView = new LanguageTree(list);
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 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)
	{
		list.remove(treeView.getSelectedIter);
		return true;
	}
}
    
    
More information about the Digitalmars-d-learn
mailing list