Re: TreeView menu



Uzytkownik <uzytkownik2 <at> gmail.com> writes:


Maciej Piechotka <uzytkownik2 <at> gmail.com> writes:

Is it possible in gtk(I use Gtk#)?
User click left mouse to some item and it shows menu (I don't know how this
menu is calling in English) with some function (Add/Delete).
How should I do it?

I found some example on GTK reference documentation but I don't know how to
translte it into Gtk# (Problem with union).

Regards.


I found:
http://www.go-mono.com/docs/monodoc ashx?tlink=5 ecma%3a1000%23Menu%2fM%2fPopup%2f4

But it dosen't works:
...
        EventBox eb;
        PackStart(eb = new EventBox()); {
                eb.Add(tv = new TreeView()); {
                        ls = new ListStore(new Type[]{typeof(String), typeof(Kategoria)});
                        tv.HeadersVisible = true;
                        tv.Model = ls;
                        tv.AppendColumn("Kategorie", new CellRendererText(), "text", 0);
                } tv.ShowAll();
                eb.ButtonPressEvent += PopupMenu;
        } eb.Show();
...
internal Menu CreateMenu() {
        Menu menu = new Menu(); {
                MenuItem mi;
                
                menu.Append(mi = new MenuItem("Dodaj"));
                mi.Show();
                menu.Append(mi = new MenuItem("Usun"));
                mi.Show();
        } menu.Show();
        return menu;
}
                
private void PopupMenu(System.Object o, ButtonPressEventArgs e) {
        if(e.Event.Button == 3)
                CreateMenu().Popup(null, null, null, 3, e.Event.Time);
}

I see TreeView but no popup menu.

Regards
PS.
Sorry I'm not using gtk-sharp-list but link doesn't work
(http://lists.ximian.com/mailman/listinfo/gtk-sharp-list)  




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]