[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:

http://www.mono-project.com/GtkSharp_TreeView_Tutorial

Luciano

>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 ([130.57.169.22]) 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 [127.0.0.1])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 [130.57.169.19])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 
>[67.18.89.2])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 10.224.233.220.exetel.com.au 
>([220.233.224.10]:1251helo=innovative.hardwarehookups.com.au)by 
>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-Message-Info: 
>txF49lGdW41quHmtWVE+ncj0bKQCINVJzRzYYzK4OyzFeaZ5TTn4Oelo1whW2nM9
>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 7.0.1.0
>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 
>tests=FORGED_RCVD_HELO,MY_OBFUX,MY_OBFUY,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: 16 Mar 2007 13:52:48.0948 (UTC) 
>FILETIME=[6211DF40:01C767D2]
>
>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(),
>DialogFlags.Modal);
>              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.
>---------------------------------------------------------------------------------
>Aaron Oxford   -   aaron+hardwarehookups .com .au
>Director, Innovative Computer Solutions (Aust) Pty. Ltd.
>49 Maitland Rd, Mayfield, NSW 2304 Australia
>http://www.ic-solutions.com.au
>Developer, SourceForge project VioLet Composer
>http://sourceforge.net/projects/buzz-like
>
>_______________________________________________
>Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

_________________________________________________________________
Visita MSN Latino Entretenimiento: ¡música, cine, chismes, TV y más...! 
http://latino.msn.com/entretenimiento/



More information about the Gtk-sharp-list mailing list