[Gtk-sharp-list] Determining if a specific cell in a TreeView has been clicked?

aybiss aaron at hardwarehookups.com.au
Wed Apr 11 04:49:43 EDT 2007


Hi naijreja,

Try this (cut and paste from my own code):

            machineList = new ListStore("".GetType(), new
object().GetType());
            machineListWidget = new TreeView(machineList);
            machineListWidget.AppendColumn("Machines", new
CellRendererText(), "text", 0);
            machineListWidget.CursorChanged += new
EventHandler(machineList_SelectedIndexChanged);
            machineList.AppendValues("A Machine", new
ParameterisedMachineBase());

            private TreePath getSelectedMachine()
            {
                TreePath argsPath = null;
                TreeViewColumn col = null;
                machineListWidget.GetCursor(out argsPath, out col);
                return argsPath;
                // Here you could also return the column that was clicked.
            }

            private MachineBase getSelectedMachineObj()
            {
                MachineBase mach = null; TreeIter iter;

                TreePath path = getSelectedMachine();
                if (machineList.GetIter(out iter, path)) mach =
(MachineBase)machineList.GetValue(iter, 1);
                return mach;
            }


naijireja naijireja wrote:
> 
> Hi all,
> 
> In GTK#, is there a way to determine if a specific cell has been clicked? 
> I need to implement this functionality because I want to "simulate" a
> column that contains hyperlinks.
> 
> Thanks,
> naijireja
> 
> 

-- 
View this message in context: http://www.nabble.com/Determining-if-a-specific-cell-in-a-TreeView-has-been-clicked--tf3545126.html#a9935446
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list