[Gtk-sharp-list] how can I get value in CellRendererCombo withmulticolumn Model?

Luciano _ lnc19 at hotmail.com
Mon Feb 5 10:53:23 EST 2007


Try this:

private void OnEdited(object o, EventArgs a)
{
   TreeIter iter;
    if(TheTreeView.Selection.GetSelected(out iter)) // This return the 
selected Iter
   {
        Console.WriteLine(TheTreeView.Model.GetValue(iter, 0)) // This print 
the first column content
        Console.WriteLine(TheTreeView.Model.GetValue(iter, 1)) // This print 
the second column content
   }
}



>From: "Dr. McArrow" <dr_mcarrow at mail.ru>
>To: gtk-sharp-list at lists.ximian.com
>Subject: [Gtk-sharp-list] how can I get value in CellRendererCombo 
>withmulticolumn Model?
>Date: Mon, 05 Feb 2007 17:28:11 +0200
>MIME-Version: 1.0
>Received: from lists.ximian.com ([130.57.169.22]) by 
>bay0-mc2-f20.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Mon, 5 
>Feb 2007 07:28:29 -0800
>Received: from galactus.ximian.com (localhost.localdomain [127.0.0.1])by 
>lists.ximian.com (Postfix) with ESMTP id 040811CFC86;Mon,  5 Feb 2007 
>11:54:29 -0500 (EST)
>Received: from herald.ximian.com (frontgate.ximian.com [130.57.169.19])by 
>lists.ximian.com (Postfix) with ESMTP id 2A0691CFB76for 
><gtk-sharp-list at lists.ximian.com>;Mon,  5 Feb 2007 11:54:28 -0500 (EST)
>Received: by herald.ximian.com (Postfix, from userid 2601)id B554470029; 
>Mon,  5 Feb 2007 10:28:26 -0500 (EST)
>Received: from mx4.mail.ru (fallback.mail.ru [194.67.57.14])by 
>herald.ximian.com (Postfix) with ESMTP id E6D7770029for 
><gtk-sharp-list at lists.ximian.com>;Mon,  5 Feb 2007 10:28:22 -0500 (EST)
>Received: from mx33.mail.ru (mx33.mail.ru [194.67.23.194])by mx4.mail.ru 
>(mPOP.Fallback_MX) with ESMTP id 50E2F388802for 
><gtk-sharp-list at lists.ximian.com>;Mon,  5 Feb 2007 18:28:21 +0300 (MSK)
>Received: from [91.124.108.220] (port=20569 helo=dr)by mx33.mail.ru with 
>psmtp id 1HE5lM-000Ezi-00for gtk-sharp-list at lists.ximian.com; Mon, 05 Feb 
>2007 18:28:13 +0300
>X-Message-Info: txF49lGdW43HTtWShKnOP1skam+SM4CZTxjqs+Yu/To=
>X-Original-To: gtk-sharp-list at lists.ximian.com
>Delivered-To: gtk-sharp-list at lists.ximian.com
>User-Agent: Opera Mail/9.10 (Win32)
>X-Antivirus: avast! (VPS 0710-2, 05.02.2007), Outbound message
>X-Antivirus-Status: Clean
>X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on 
>frontgate.ximian.com
>X-Spam-Level: *
>X-Spam-Status: No, score=2.0 required=5.0 
>tests=FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS version=3.0.3
>X-BeenThere: gtk-sharp-list at lists.ximian.com
>X-Mailman-Version: 2.1.8
>Precedence: list
>List-Id: "Discussion of the .Net bindings for 
>Gnome"<gtk-sharp-list.lists.ximian.com>
>List-Unsubscribe: 
><http://lists.ximian.com/mailman/listinfo/gtk-sharp-list>,<mailto:gtk-sharp-list-request at lists.ximian.com?subject=unsubscribe>
>List-Archive: <http://lists.ximian.com/pipermail/gtk-sharp-list>
>List-Post: <mailto:gtk-sharp-list at lists.ximian.com>
>List-Help: <mailto:gtk-sharp-list-request at lists.ximian.com?subject=help>
>List-Subscribe: 
><http://lists.ximian.com/mailman/listinfo/gtk-sharp-list>,<mailto:gtk-sharp-list-request at lists.ximian.com?subject=subscribe>
>Errors-To: gtk-sharp-list-bounces at lists.ximian.com
>Return-Path: gtk-sharp-list-bounces at lists.ximian.com
>X-OriginalArrivalTime: 05 Feb 2007 15:28:29.0746 (UTC) 
>FILETIME=[49BDE120:01C7493A]
>
>I have a CellRendererCombo in a treeview.
>how can I retrive a value from a column different than the one defined by
>TextColumn?
>My ListStore holds two values: an id from a database and a string.
>TextColumn points to the string (column 0), but I want to know the id (col
>1).
>
>
>ListStore ls_dept = new ListStore(typeof(string),typeof(string));
>ls_dept.AppendValue("sssss","1");
>ls_dept.AppendValue("zzzzz","2")
>
>...
>
>CellRendererCombo crc = new CellRendererCombo();
>crc.Editable = true;
>crc.Model = ls_dept;
>crc.TextColumn = 0;
>crc.Edited += (OnEdited);
>...
>
>private void OnEdited(object o, EventArgs a)
>{
>in this place i need to know the value of column 1.
>how can I do this?
>}
>
>
>--
>Dr.McArrow
>_______________________________________________
>Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

_________________________________________________________________
¿Cuánto vale tu auto? Tips para mantener tu carro. ¡De todo en MSN Latino 
Autos! http://latino.msn.com/autos/



More information about the Gtk-sharp-list mailing list