-
July 27th, 2005, 10:40 AM
#1
Cursor goes to beginning of digits in edit box!
I have a multiline, numerical only non-rich edit box with right allignment. But when I enter a digit, the first digit appears rightmost (as it should) but the cursor jumps to the beginning of the number thus the result is that the number is entered backwards. So entering 6,4,5 will give the number 546.
Now I subclass this procedure so there must be something I do in the handling of messages that prevents the system from restoring the cursor to the right. I cannot find a message to send to the edit box which places the cursor to the right (or does anything with the cursor).
Any ideas or know how on how to control the cursor?
Brian
-
July 27th, 2005, 10:46 AM
#2
Re: Cursor goes to beginning of digits in edit box!
Originally Posted by Gyannea
I have a multiline, numerical only non-rich edit box with right allignment. But when I enter a digit, the first digit appears rightmost (as it should) but the cursor jumps to the beginning of the number thus the result is that the number is entered backwards. So entering 6,4,5 will give the number 546.
Now I subclass this procedure so there must be something I do in the handling of messages that prevents the system from restoring the cursor to the right. I cannot find a message to send to the edit box which places the cursor to the right (or does anything with the cursor).
Any ideas or know how on how to control the cursor?
Brian
try this may be this one help u
open the property dialog of edit control in that choose style.
and select align text left
-
July 27th, 2005, 11:24 AM
#3
Re: Cursor goes to beginning of digits in edit box!
Did that already, but it doesn't help. The problem comes from a 'SetWindowText()' API function used in the subprocedure. When a WM_CHAR message is received, the standard handler is used, but after that I GetWindowTExt() to see if the number has exceeded certain limits. If it does, I enter the new corrected number into the edit box. However, the cursor appears to the left of that newly entered number and not the right. From then on, entries will be as they should (number enter to the right but displaced to the left of the number I entered) until I cross limits again then the whole thing starts over again.
I need to get Windows to recognize my corrected entry as part of the number!
Brian
-
July 27th, 2005, 11:51 PM
#4
Re: Cursor goes to beginning of digits in edit box!
Originally Posted by Gyannea
Did that already, but it doesn't help. The problem comes from a 'SetWindowText()' API function used in the subprocedure. When a WM_CHAR message is received, the standard handler is used, but after that I GetWindowTExt() to see if the number has exceeded certain limits. If it does, I enter the new corrected number into the edit box. However, the cursor appears to the left of that newly entered number and not the right. From then on, entries will be as they should (number enter to the right but displaced to the left of the number I entered) until I cross limits again then the whole thing starts over again.
I need to get Windows to recognize my corrected entry as part of the number!
Brian
Can you post your code.
so we can c how u r trying to achive this.
and check once again with SetDlgItemText() method
Last edited by humptydumpty; July 28th, 2005 at 12:26 AM.
-
July 28th, 2005, 05:27 AM
#5
Re: Cursor goes to beginning of digits in edit box!
The problem is in the subclassing (otherwise it doesn't happen). I have found a work around. After I call the 'SetWindowText()' API function I post a WM_KEYDOWN message and fake an arrow key of my choice. That moves the cursor to where it would be without the call.
Brian
-
July 28th, 2005, 12:08 PM
#6
Re: Cursor goes to beginning of digits in edit box!
You can use SetSel to move the caret
-
July 28th, 2005, 02:50 PM
#7
Re: Cursor goes to beginning of digits in edit box!
Wouldn't have guessed by the name! Thanks, that sounds better thanfaking an arrow key!
Brian
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|