[Gtk-sharp-list] Newbie questions with code

Luciano _ lnc19 at hotmail.com
Fri Mar 16 11:49:12 EDT 2007

Sorry, i forget some part :)
For change the colors, and other styles for a TreeView you need to use:

SetCellDataFunc (TreeColumn), please, read the info in mono-project page for 
more info:



>From: Aaron Oxford <aaron at hardwarehookups.com.au>
>To: gtk-sharp-list at lists.ximian.com
>Subject: [Gtk-sharp-list] Newbie questions with code
>Date: Sat, 17 Mar 2007 00:50:38 +1100
>MIME-Version: 1.0
>Received: from lists.ximian.com ([]) by 
>bay0-mc8-f20.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Fri, 
>16 Mar 2007 06:52:48 -0700
>Received: from galactus.ximian.com (localhost.localdomain [])by 
>lists.ximian.com (Postfix) with ESMTP id B8DEF1CFC59;Fri, 16 Mar 2007 
>11:32:54 -0400 (EDT)
>Received: from herald.ximian.com (frontgate.ximian.com [])by 
>lists.ximian.com (Postfix) with ESMTP id 8D03D1CFC49for 
><gtk-sharp-list at lists.ximian.com>;Fri, 16 Mar 2007 11:32:53 -0400 (EDT)
>Received: by herald.ximian.com (Postfix, from userid 2601)id 68CFD70013; 
>Fri, 16 Mar 2007 08:52:45 -0500 (EST)
>Received: from rs8.websiteswelcome.com (rs8.websiteswelcome.com 
>[])by herald.ximian.com (Postfix) with ESMTP id 567B870013for 
><gtk-sharp-list at lists.ximian.com>;Fri, 16 Mar 2007 08:52:40 -0500 (EST)
>Received: from 
>rs8.websiteswelcome.com with esmtpa (Exim 4.63)(envelope-from 
><aaron at hardwarehookups.com.au>) id 1HSCpg-0002E9-4Hfor 
>gtk-sharp-list at lists.ximian.com; Fri, 16 Mar 2007 15:51:00 +0200
>X-Original-To: gtk-sharp-list at lists.ximian.com
>Delivered-To: gtk-sharp-list at lists.ximian.com
>X-Mailer: QUALCOMM Windows Eudora Version
>X-AntiAbuse: This header was added to track abuse,please include it with 
>any abuse report
>X-AntiAbuse: Primary Hostname - rs8.websiteswelcome.com
>X-AntiAbuse: Original Domain - lists.ximian.com
>X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
>X-AntiAbuse: Sender Address Domain - hardwarehookups.com.au
>X-Source: X-Source-Args: X-Source-Dir: X-Spam-Checker-Version: SpamAssassin 
>3.0.3 (2005-04-27) on frontgate.ximian.com
>X-Spam-Level: ***
>X-Spam-Status: No, score=3.9 required=5.0 
>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 
><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>
><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: 16 Mar 2007 13:52:48.0948 (UTC) 
>Hi all,
>I realise I've been a bit slack with providing evidence of my
>problems. This is a two parter with code for each, covering all the
>topics I've discussed so far. First up is just something simple that
>seems broken in the Dialog class, or maybe the ScrolledWindow.
>              Gtk.Dialog dlg = new Dialog(caption, GtkWindow.getWin(),
>              dlg.AddButton(Gtk.Stock.Yes, Gtk.ResponseType.Yes);
>              dlg.AddButton(Gtk.Stock.No, Gtk.ResponseType.No);
>              dlg.DefaultResponse = Gtk.ResponseType.None;
>              ScrolledWindow sw = new ScrolledWindow();
>              Label l = new Label(" a very very very very .... long string 
>              l.Wrap = true;
>              sw.Add(l);
>              dlg.VBox.PackStart(sw);
>              dlg.SetDefaultSize(320, 160);
>              dlg.ShowAll();
>              int resp = dlg.Run();
>              dlg.Destroy();
>If you call this with a long string in message, the label simply
>clips at the border of the dialog. Without the ScrolledWindow, you
>end up with an OK looking dialog. If the message is REALLY long
>though, the window goes off the top and bottom of the screen, so you
>can't close it (except if you know about Alt-F4). I thought the
>ScrolledWindow would fix this. Am I doing something wrong? Forcing
>scrollbars with the policy shows bars I can't move.
>Second, and more importantly, the TreeView again. I need to control
>where the cursor goes, so the user doesn't become confused as to what
>they are viewing in the main pane. It would be cool to be able to
>highlight a given row as well as having a selection. Is this possible?
>In any case I've found a way to crash my program by trying the code
>below. Note I'm in a RowActivated handler, and this code only crashes
>*some* of the time. As I write this and test the code it's gone from
>working, to crashing, to not working (not crashing) and now seems to
>be consistently not working.
>          void machineList_RowActivated(object o, RowActivatedArgs args)
>          {
>              TreePath argsPath = editListPath;
>              if (args != null) argsPath = args.Path;
>              // If the file has been edited, we need to ask the user
>if they want to discard their changes
>              // by loading a different file.
>              if (fileChanged)
>              {
>                  if (argsPath != editListPath)
>                  {
>                      if (!App.window.showQuestion("Are you sure you
>want to...", "File Changed"))
>                      {
>                          //   *** CRASH RIGHT HERE ***
>                          machineListWidget.SetCursor(editListPath,
>machineListWidget.Columns[0], false);
>                          return;
>                      }
>                  }
>                  else
>                  {
>                      return;
>                  }
>              }
>I'm starting to get really nervous, because this sort of thing:
>System.AccessViolationException: Attempted to read or write protected
>memory. This is often an indication that other memory is corrupt.
>     at Gtk.TreeView.gtk_tree_view_set_cursor(IntPtr raw, IntPtr path,
>IntPtr focus_column, Boolean start_editing)
>     at Gtk.TreeView.SetCursor(TreePath path, TreeViewColumn
>focus_column, Boolean start_editing)
>     at Wavelet_Tracker.MachineManager.machineList_RowActivated(Object
>o, RowActivatedArgs args)
>Has popped up before as I mentioned, and is popping up at random all
>the time now. This could be really bad news for the stability of my
>app, which was just finally starting to mature in that respect. Any
>help with this in particular would be very much appreciated.
>Aaron Oxford   -   aaron+hardwarehookups .com .au
>Director, Innovative Computer Solutions (Aust) Pty. Ltd.
>49 Maitland Rd, Mayfield, NSW 2304 Australia
>Developer, SourceForge project VioLet Composer
>Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com

Visita MSN Latino Entretenimiento: ¡música, cine, chismes, TV y más...! 

More information about the Gtk-sharp-list mailing list