This code shows how to insert a string into the current position of a textbox component.
var t = $('#tt');
var start = t.textbox('getSelectionStart');
var s = t.textbox('getText');
s = s.slice(0,start) + 'new str' + s.slice(start);
t.textbox('setText', s);