Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

How can I get the position of cursor in then text box?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-19-2008, 03:42 AM
Newbie
 
Join Date: Aug 2008
Posts: 8
Default How can I get the position of cursor in then text box?

I import the lib dzHw,and use function SendMessageToControl.

'get the position of cursor
Sub GetCurLine(txtboxname)
linechar = hdObj.SendMessageToControl(txtboxname, EM_LINEINDEX, -1, 0)
curline = hdObj.SendMessageToControl(txtboxname, EM_LINEFROMCHAR, linechar, 0)
linefirstno = hdObj.SendMessageToControl(txtboxname,EM_GETFIRSTV ISIBLELINE,0,0)
Msgbox(curline & "+" & linefirstno,"Tips")
End Sub

When debug, an error ocurred."System.OverflowException"
"linechar = hdObj.SendMessageToControl(txtboxname, EM_LINEINDEX, -1, 0)"
Error Description: value -1 Uint32 too big or small??

How can I do? Tks
Reply With Quote
  #2 (permalink)  
Old 08-19-2008, 05:45 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

txtboxname.SelectionStart will return the position of the cursor.
Reply With Quote
  #3 (permalink)  
Old 08-20-2008, 01:41 AM
Newbie
 
Join Date: Aug 2008
Posts: 8
Default

Tks erel.
But when text wordwraped ,value returned from txtboxname.SelectionStart isn't the visible position.
Reply With Quote
  #4 (permalink)  
Old 08-20-2008, 05:19 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

txtBoxName.SelectionStart returns the cursor position.
Are you looking for something else?
Reply With Quote
  #5 (permalink)  
Old 08-20-2008, 05:53 AM
Newbie
 
Join Date: Aug 2008
Posts: 8
Default

Quote:
Originally Posted by Erel View Post
txtBoxName.SelectionStart returns the cursor position.
Are you looking for something else?
value of txtBoxName.SelectionStart is the position from first char of txtBoxName.text, I'd like to get cursor position of visible lines in the textbox .
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass Text into other application at current cursor position...? TWELVE Questions (Windows Mobile) 9 12-05-2008 11:52 AM
Get cursor position in textbox? tsteward Questions (Windows Mobile) 3 08-08-2008 02:16 AM
Windows position WZSun Basic4ppc Wishlist 12 06-08-2008 03:56 AM
Tables - column position LineCutter Questions (Windows Mobile) 6 02-22-2008 03:30 PM
Not losing cursor position after running/compiling Woinowski Basic4ppc Wishlist 0 01-16-2008 08:18 AM


All times are GMT. The time now is 05:17 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0