Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Uppercase !


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-09-2008, 09:07 AM
Knows the basics
 
Join Date: Mar 2008
Posts: 54
Default Uppercase !

I know that this is stupid question but I'm agonize with...

(I want to make desktop application)
I have TextBox (Only One) And after key_press I want string automatically go to uppercase.
I have this:

Sub TextBox1_KeyPress(key)
TextBox1.Text = StrToUpper(TextBox1.Text)
End Sub

So, when I push First Key, nothings happen - (lowercase), and when I push second key, then the First Key Is Uppercase, the CURSOR is on the beginning of the TextBox1 focus, and ONE FROM ANOTHER every next key is Uppercase, BUT MY WORDS IS TOPSY-TURVY ...

Aaaaaaahhhhh

Some Help...?

Thx
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 09:57 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

You have two problems here. Firstly you get the KeyPress event before that key is added to the textbox so it doesn't get uppercased. Secondly the insertion point is lost when you uppercase the string.

The solution to the first is to use the new Door library Door library (Beta) - Special library to catch the TextChanged event which occurs after the key is added. The solution to the second is to save and restore the insertion point.
Attached Files
File Type: zip UpperCase.zip (4.5 KB, 16 views)

Last edited by agraham : 04-09-2008 at 10:02 AM.
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 09:58 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

You should use the TextChanged event (with the Door library):
Code:
'obj is an Object, TextBox1ChangedEvent is an Event.
Sub App_Start
    Form1.Show
    obj.New1(false)
    obj.FromControl("textbox1")
    TextBox1ChangedEvent.New1( obj.Value,"TextChanged")
End Sub

Sub TextBox1ChangedEvent_NewEvent
    textbox1.text = StrToUpper(TextBox1.Text)
    textbox1.SelectionStart = StrLength(textbox1.text)
End Sub
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 10:02 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Beat you this time Erel (but by only one minute!)
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 10:04 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

I can only say "great minds think alike"
Reply With Quote
  #6 (permalink)  
Old 04-09-2008, 10:04 AM
Knows the basics
 
Join Date: Mar 2008
Posts: 54
Default Thanks Boys !!!

Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Structures & Uppercase skipper Questions & Help Needed 4 02-06-2008 07:00 AM
lowercase 2 uppercase kavka Questions & Help Needed 1 01-12-2008 10:25 PM


All times are GMT. The time now is 02:22 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0