The caret position wont change since you don't have avalue on settext and setcaretposition(0). The best wayto do this is do settext("this is the text") andsetcaretposition( 2) there you will see thecaretposition you had just set.