PDA

View Full Version : Input Smiley Code Adding Problem



GoOgLe
03-29-2007, 06:56 AM
strText = Input.GetText("Input1");
cPos=GetCaretPos("Input1")
selString = Input.GetSelection("Input1");
cRow=GetCaretRow("Input1")
BeforCaret = String.Mid(strText, 1, cPos);
AfterCaret = String.Mid(strText, cPos, -1);
Input.SetText("Input1", BeforCaret..":)"..AfterCaret);
Input.ScrollToLine("Input1", cRow);
Input.SetSelection("Input1", cPos+3, cPos+3);

why this code selectes wrong place after adding more than 1 smiley code ????
i think this is true;

Input.SetSelection("Input1", cPos+3, cPos+3);

GoOgLe
03-29-2007, 07:00 AM
i fixed it like that but if anybody have better idea please let me know
thanks


strText = Input.GetText("Input1");
cPos=GetCaretPos("Input1")
cRow=GetCaretRow("Input1")
BeforCaret = String.Mid(strText, 1, cPos);
AfterCaret = String.Mid(strText, cPos, -1);
Input.SetText("Input1", BeforCaret..":)"..AfterCaret);
Input.ScrollToLine("Input1", cRow);
Input.SetSelection("Input1", cPos, cPos);