Selecting TextBox Text Part II#

Thanks to Daniel Moth for the tip on using a Timer instead of a thread to select text in the textbox. Basically it negates the need for Sleep() and/or Invoke() and makes for a bit cleaner code. Here is the updated code.  I have left the thread version in the GotFocus but have commented it out.

 

private TextBox currentTB = null;
    private void GenericTextBox_GotFocus(object sender, System.EventArgs e)
    {
        this.currentTB = (TextBox)sender;

        //Use a timer to select all. This will negate the need for Invoke or sleep in the thread. Thanks to Daniel Moth for this :-)
        Timer t = new Timer();
        t.Interval = 10;
        t.Tick+=new EventHandler(t_Tick);
        t.Enabled = true;

        /*
         * USE THIS SECTION TO USE A THREAD BUT THE TIMER METHOD IS BETTER/CLEANER
        System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(SelectAll));
        t.Start();
        */

    }

    private void SelectAll()
    {
        if(this.currentTB!=null)
        {
            //Usuall the Invoke should finish after the got focus event finishs. If you experience problems add a sleep
            //System.Threading.Thread.Sleep(50);
            currentTB.Invoke(new EventHandler(InvokeSelectAll));
            currentTB = null;
        }
    }

    private void InvokeSelectAll(object sender, System.EventArgs e)
    {
        ((TextBox)sender).SelectAll();
    }

    private void t_Tick(object sender, EventArgs e)
    {
        ((Timer)sender).Enabled =false;
        this.currentTB.SelectAll();
    }


Tuesday, March 22, 2005 8:46:17 AM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

History of WindowsCE#

Late night surfing and found this.  http://www.hpcfactor.com/support/windowsce/  Interesting article on the history of windows CE from V1 to V5 with screen shots.


Monday, March 14, 2005 10:59:51 PM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

Newsgroup "Etiquette"#

Daniel Moth writes about some “rules” for using the NGs.  I completely agree and hope people read and follow.  One thing I would like to add

“Due Diligence”
Do your due dilegence before posting.  By this I mean please do some research before posting or try to code something before posting.  If you can't get your code working then first go to Google and type in your problem.  Usually by searching the problem in Google or Google Groups and searching specifically in the Compact Framework Group you will most likely find an answer to your question.  If trying to write the code yourself and searching Google/Google Groups doesn't help then post a question but please learn to help yourself first. 


Monday, March 14, 2005 10:24:05 AM (Eastern Standard Time, UTC-05:00) #    Comments [1]  | 

 

Selecting TextBox Text#

There was a question in the newsgroups about selecting text in a textbox when it receives focus.  I thought it was as simple as TextBox.SelectAll() but apparently it's not!  If you trap the OnFocus event and use SelectAll() it does work but when the OnFocus handler is done the base Textbox puts the carret where ever the user clicked the stylus thus removing the selectAll(). 

Here is some code to overcome this:

private TextBox currentTB = null;
private void GenericTextBox_GotFocus(object sender, System.EventArgs e)
{
  this.currentTB = (TextBox)sender;
  System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(SelectAll));
  t.Start();
}   
 
private void SelectAll()
{
  if(this.currentTB!=null)
  {
    //Usuall the Invoke should finish after the got focus event finishs. If you experience problems add a sleep
    //System.Threading.Thread.Sleep(50);
    currentTB.Invoke(new EventHandler(InvokeSelectAll));
    currentTB = null;
  }
}

private void InvokeSelectAll(object sender, System.EventArgs e)
{
  ((TextBox)sender).SelectAll();
}


Friday, March 11, 2005 2:02:15 PM (Eastern Standard Time, UTC-05:00) #    Comments [2]  | 

 

Another Personality test...#
8:30am so might as well take a personality test courtesy Chris Tacke...Looks like I have an intellectual, independant and intraverted personality
 
Cattell's 16 Factor Test Results
Warmth |||||||||||| 34%
Intellect ||||||||||||||||||||| 70%
Emotional Stability ||||||||||||||| 50%
Aggressiveness |||||||||||||||||| 54%
Liveliness ||||||||||||||| 50%
Dutifulness |||||||||||||||||| 58%
Social Assertiveness ||||||||| 26%
Sensitivity |||||||||||| 38%
Paranoia |||||||||||||||||| 58%
Abstractness ||||||||||||||| 46%
Introversion ||||||||||||||||||||| 66%
Anxiety ||||||||||||||| 46%
Openmindedness ||||||||||||||| 42%
Independence ||||||||||||||||||||| 70%
Perfectionism ||||||||||||||| 42%
Tension ||||||||||||||| 50%
Take Cattell 16 Factor Test (similar to 16pf)
personality tests by similarminds.com

Friday, March 11, 2005 8:43:32 AM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

Bell Canada to offer wVOIP #

Looks like Bell Canada has made a deal with Clearwire to be the exclusive partner for VOIP services and will target worldwide markets not just North America.  They say it will make Bell Canada a pioneer in the wVOIP market and I think it's great that Bell Canada is getting into this and wish them all the luck with this venture.  I think VOIP is a huge market and already have my business line on VOIP with Vonage.  Hopefully the CRTC (like the US FCC) doesn't add any charges for VOIP services but so far they are saying they don't regulate the Internet.  Bell Mobility (owned by BCE who also owns Bell Canada) are also the only provider for MapPoint Location Server so they are right up there with using some of todays leading edge technologies.  Now only if they would get some better Pocket PCs and SmartPhones!

http://seattletimes.nwsource.com/html/businesstechnology/2002201300_clearwire09.html


Thursday, March 10, 2005 12:02:48 PM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

Windows Mobile With HardDrive#

Samsung developed a new windows mobile cell phone with a 3GB HD and showing it at CeBit in Germany .  Looks like Apple has inspired companies (with the iPod) yet again with thier innovative products.  I think it's the next logical step with proliferation of mobile media into the consumer market...currently devices lack space but now with HDs getting smaller than ever the HD space is finally here.  No price yet but i'm sure it will cost a fortune!
http://www.infoworld.com/cgi-bin/redirect?source=rss&url=http://www.infoworld.com/article/05/03/10/HNsamsunghddphone_1.html


Thursday, March 10, 2005 11:58:56 AM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

Microsoft Opens R&D Mobile Tech lab#

MS has opened a mobile software/services tech lab in South Korea.  I think the Asian markets want to try all the new gadgets first and want to have the latest and greatest.  Apparently this is why MS has opened a lab there, they want to capatalize on this and help vendors create bleeding edge applications for this market. Makes good business sense and hopefully this will give MS more market penetration for Pocket PCs and SmartPhones.

http://www.infoworld.com/cgi-bin/redirect?source=rss&url=http://www.infoworld.com/article/05/03/09/HNmskorealab_1.html


Thursday, March 10, 2005 11:57:59 AM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

Microsoft to buy Groove Networks#

Microsoft to buy Groove Networks and Ray Ozzie to become CTO at MS.  I think it's great that Groove is becoming an MS product.  Coming from a Lotus Notes Domino background (and being certified for V4,5,6) I thought Notes was a great product.  When Ray Ozzie started Groove I bought the first release version and it was awesome and the latest version is even better.  Although I didn't buy the latest version I did try the demo.  I couldn't justify buying a collaboration application when it's only me :)  The first version I bought just to play around with it.  One thing it's missing is some sort of plugin for Pocket PC and don't think anyone is working on it.  I think Groove will get even better and hopefully integrated more with MS Products (including Pocket PC) in the near future.

http://news.com.com/Microsoft+to+buy+Groove+Networks/2100-1014_3-5608063.html?part=rss&tag=5606366&subj=news


Thursday, March 10, 2005 11:57:21 AM (Eastern Standard Time, UTC-05:00) #    Comments [0]  | 

 

All content © 2008, Mark Arteaga
Related Sites
Archives
Sitemap
Disclaimer

Powered by: newtelligence dasBlog 1.9.7174.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts