PDA

View Full Version : getSelectionPosition


epopov
02-12-2004, 11:42 AM
Hi,
I want to check selection while editing some text in my inputtext. But when I push some button it loses focus and getSelectionPosition returns -1.
I perform workaround and save position onIdle after inputtext gets focus (onfocus event). But when I push edit button before edit procedure starts, and manually set focus to inputtext , i.e. setAttribute('focus',true), my onIdle doesn't works. It works only when I move cursor to other inputtext field and set it back.

May be there is some other workaround? May be you know the reason of my problem?

Thanks.

epopov
02-13-2004, 07:20 AM
Hi!
I found another workaround: instead of saving selection position onIdle I save it in onmouseover handlers of buttons. It works!

ch_bowen
03-30-2004, 02:46 PM
Are there any circumstances where the inputtext component fails to display text when inputtext.setText() is called? We are wrapping the inputtext component to make it look a little better and extend some of its functionality. Our component works fine with 2 of our applications but is not working in another. It seems like something is catching an event that shouldn't be?

I even tried just using inputtext without using our own component and calling inputtext.setText("MyText") and still, nothing appears.

Its extremely frustrating trying to track down this problem and we are confused by it.

Thanks in advance for anyone that can help,

Chris

vfunshteyn
03-31-2004, 11:07 AM
What version of LPS are you running? In 2.x, the following works for me:


<canvas>

<inputtext width="250" bgcolor="0xc0c0c0" name="it"/>
<button y="50" text="set text" onclick="it.setText('Here I am, same as ever')"/>
</canvas>

ch_bowen
04-08-2004, 12:39 PM
It seems when extending some base components, that one already needs to be created. When putting a hidden inputtext on the canvas, it seems to allow our extending components to work. Not sure if this is proper or not, but it seemed to fix the problem.

kusalacitta
11-17-2005, 03:42 AM
hi epopov,
I also have the same result when running getSelectionPosition method, that the value always return -1 when the text is selected.
Can you share about your way to getSelectionPosition of inputtext?

Thanks