My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
HRegExEntry  
HRegExEntry widget information
Updated Feb 4, 2010 by fr.dan...@gmail.com

Introduction


Methods: none

Properties:

Gtk.Entry Entry gets the inner Entry
string Text gets/sets the current text
bool IsTextValid returns true if current text is valid
string RegularExpression regular expression used to check the text
string OkMessage the tooltip message when text is valid
string ErrorMessage the tooltip message when text is not valid

Events: none


Details

  • Code sample:
// Test.cs created with MonoDevelop

using System;
using HollyLibrary;


namespace test
{
	
	
	public class Test : Gtk.Window
	{
		
		HRegExEntry entry = new HRegExEntry();
		Gtk.Button  btn   = new Gtk.Button("push me");

                public Test() : base(Gtk.WindowType.Toplevel)
                {
			this.DeleteEvent   += new Gtk.DeleteEventHandler( this.OnDeleteEvent );
			
			btn.Clicked        += new EventHandler( this.on_btn_clicked );
			entry.RegularExpression = "\\d{3}-\\d{2}-\\d{4}";
			entry.ErrorMessage      = "Wrong format!";
			entry.OkMessage         = "Yeah, it's ok now";
			
			Gtk.VBox layout = new Gtk.VBox();
			
			layout.PackStart( entry );
			layout.PackStart( btn   );
			
			this.Add(layout);
			//show window
			this.ShowAll();
                }

		private void on_btn_clicked( object o, EventArgs args )
		{
			Console.WriteLine( "Entry is valid: " + entry.IsTextValid  );
		}
		
                protected virtual void OnDeleteEvent (object o, Gtk.DeleteEventArgs args)
                {
                    Gtk.Application.Quit();
                    args.RetVal = true;
                }

                public static void Main (string[] args)
                {
                   Gdk.Threads.Init ();
                   Application.Init ();
                   Test win = new Test();
                   win.Show ();
                   Gdk.Threads.Enter();
                   Application.Run ();
                   Gdk.Threads.Leave();
                }

	}
}
Powered by Google Project Hosting