Click here to Skip to main content
15,885,186 members
Articles / Mobile Apps

ForestPad - a method for storing and retrieving textual information

Rate me:
Please Sign up or sign in to vote.
3.85/5 (14 votes)
6 Jun 2004CPOL11 min read 131K   404   30  
Three applications: PocketPC, Windows Desktop, and a Web Service collaborate to syncronize your textual information
using System;
using System.Windows.Forms;


namespace ForestPadDesktop
{
	/// <summary>
	/// Summary description for ForestPadDesktopMainForm.
	/// </summary>
	public class ForestPadDesktopBaseForm : System.Windows.Forms.Form
	{		
		//protected System.Windows.Forms.TextBox textBoxSearch;

		public ForestPadDesktopBaseForm()
		{
		}

		protected override bool ProcessCmdKey(ref Message msg, Keys keyData)	
		{
			const int WM_KEYDOWN = 0x100;
			const int WM_SYSKEYDOWN = 0x104;

			if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
			{
				switch(keyData)
				{
					case Keys.Control | Keys.K :
						foreach(Control control in this.Controls)
						{
							if(control.GetType() == typeof(TextBox))
							{
								if(control.Name == "textBoxSearch")
								{
									TextBox tb = (TextBox)control;
									tb.SelectionStart = 0;
									tb.SelectionLength = tb.Text.Length;
									tb.Focus();
								}
							}
						}
						break;

//tried to capture ctrl-a to select textbox -- doesn't work?
//
//					case Keys.Control | Keys.A :
//						foreach(Control control in this.Controls)
//						{
//							if(control.GetType() == typeof(TextBox))
//							{
//								if(control.Name == "textBox")
//								{
//									TextBox tb = (TextBox)control;
//									tb.SelectionStart = 0;
//									tb.SelectionLength = tb.Text.Length;
//									tb.Focus();
//								}
//							}
//						}
//						break;
				}				
			}
			return base.ProcessCmdKey(ref msg,keyData);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Snoffleware Studios LLC
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions