RE: Moving the Cursor

new topic     » goto parent     » topic index » view thread      » older message » newer message

> Thanks Phil and Don.
> 
> I'm begining to think that Derek Parnell was right and that it's more 
> trouble than its worth to try and put dashes in the edit box.  I came 
> across an error with either of your solutions.  If you try to edit the 
> number from the middle then the caret gets put at the end and not after 
> the number just entered.  


> To fix this, one would have to find where the caret is and then put the 
> caret back in the next place.
> 
> As a side note, Could someone explain these lines of code.  I think that 
> 
> they do the same thing.
> 
> Phil's code
> > 	 	-- This sets the caret to the end of the text
> > 	 	junk = sendMessage(self, EM_SETSEL, 0, -1 )
> > 	 	junk = sendMessage(self, EM_SETSEL, -1, -1 )

EM_SETSEL is used for "selecting" ranges of text.
0, -1 will select all.
-1, -1 will (I think) remove the selection.

Net result being that the cursor is moved to the end.

> Don's code
> >   if keyCode != 35 then
> >        RetVal = w32Func( xPostMessage, 
> >{getHandle(NUMBER_EDIT),WM_KEYDOWN,35,0} )
> 
> What does the "magic number" 35 stand for?

35 stands for the "end" key, so every keypress places the
cursor at the end of the text.



Basically they both do that exact same thing, just a different
way.

I know what your looking for, gimme a couple of days and I am
sure I can come up with something...

Don Phillips

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu