How to find the cursor position relative to its text for TextMorph or RubTextFieldArea
At first I thought that TextMorph>>cursor would return me the position of the cursor relative to its text so if I have a text like "hello" and cursor (that blinking thing) was at "o" it would return 6 but no, whatever position I try it returns always 1 . With rubric I found no way to do this either. Anyone has a clue, or to I need some kind of pharo dark magic ? Is this a bug , a feature or something in between ?
and to answer my own question the answer is TextMorph editor pointIndex. And now I can create a specialized input field only for time that automatically formats to HH:MM:SS On Wed, Nov 11, 2015 at 3:21 PM Dimitris Chloupis <kilon.alios@gmail.com> wrote:
At first I thought that TextMorph>>cursor would return me the position of the cursor relative to its text so if I have a text like "hello" and cursor (that blinking thing) was at "o" it would return 6 but no, whatever position I try it returns always 1 . With rubric I found no way to do this either.
Anyone has a clue, or to I need some kind of pharo dark magic ? Is this a bug , a feature or something in between ?
Hello Dimitris, Why do you use TextMorph and not RubScrolledTextModel or RubTextFieldMorph ? Cheers Alain
On 11 Nov 2015, at 16:28, Dimitris Chloupis <kilon.alios@gmail.com> wrote:
and to answer my own question the answer is
TextMorph editor pointIndex.
And now I can create a specialized input field only for time that automatically formats to HH:MM:SS
On Wed, Nov 11, 2015 at 3:21 PM Dimitris Chloupis <kilon.alios@gmail.com <mailto:kilon.alios@gmail.com>> wrote: At first I thought that TextMorph>>cursor would return me the position of the cursor relative to its text so if I have a text like "hello" and cursor (that blinking thing) was at "o" it would return 6 but no, whatever position I try it returns always 1 . With rubric I found no way to do this either.
Anyone has a clue, or to I need some kind of pharo dark magic ? Is this a bug , a feature or something in between ?
participants (2)
-
Alain Plantec -
Dimitris Chloupis