[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-gtk-sharp-list
Subject:    [Gtk-sharp-list] Entry/Viewport tweaks
From:       Lee Mallabone <gnome () fonicmonkey ! net>
Date:       2003-03-28 9:06:01
Message-ID: 1048842361.1028.36.camel () slayer ! dunno ! local
[Download RAW message or body]

Hi all,

I've made a minor tweak to Entry.custom to allow an Entry to be
constructed with initial text in it. It surprised me this wasn't already
in Gtk+, so I added it here.

I've also made a sample using Viewport, attached. Should I commit it to
the sample directory?

Regards,

Lee.


["entry.diff" (entry.diff)]

Index: gtk/Entry.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Entry.custom,v
retrieving revision 1.2
diff -u -r1.2 Entry.custom
--- gtk/Entry.custom	24 Feb 2003 03:13:08 -0000	1.2
+++ gtk/Entry.custom	28 Mar 2003 09:02:20 -0000
@@ -12,3 +12,8 @@
 
 	return position;
 }
+
+public Entry(string initialText): this()
+{
+	Text = initialText;
+}

["ViewportApp.cs" (ViewportApp.cs)]

// ViewportApp.cs - Gtk.Viewport class Test implementation
//
// Author: Lee Mallabone <gnome@fonicmonkey.net>
//
// (c) 2003 Lee Mallabone

namespace GtkSamples {

	using Gtk;
	using GtkSharp;
	using System;
	using System.Drawing;

	public class ViewportApp  {

		public static ScrolledWindow CreateViewport()
		{
			ScrolledWindow scroller = new ScrolledWindow();
			Viewport viewer = new Viewport();
			
			Table widgets = new Table(1, 2, false);
			
			widgets.Attach(new Entry("This is example Entry 1"), 0, 1, 0, 1);
			widgets.Attach(new Entry("This is example Entry 2"), 1, 2, 0, 1);
			
			// Place the widgets in a Viewport, and the Viewport in a ScrolledWindow
			viewer.Add(widgets);
			scroller.Add(viewer);
			return scroller;
		}
		public static int Main (string[] args)
		{
			Application.Init ();
			Window win = new Window ("Viewport Tester");
			win.DefaultSize = new Size (180, 50);
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);
			ScrolledWindow scroller = CreateViewport();
			win.Add (scroller);
			win.ShowAll ();
			Application.Run ();
			return 0;
		}

		static void Window_Delete (object obj, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

	}
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic