position fr a click in an editable field

Klaus Major klaus at major-k.de
Fri Oct 1 05:34:06 EDT 2004


Bonjour Thierry

> Hi all,
>
> Is there a trick to be able to find the current position in a line 
> within a
> text in an editable field when we click on a space ?
>
> i've tried all the **click() functions and properties, but could not
> get the information.
>
> i've wrote a little handler which calculated the position ( column 
> number )
> by using clickH() and a quick ratio with the size of the police... it 
> works
> but only for non-proportionnal fonts.
>
> Any help would be very much appreciated...

Let me see if i understand you correctly...

You want to know wheere the cursor is blinking in a field that has NO
text selected?

In that case you could try "the selectedchunk"!

When text is selected in a field it will return something like:

char x to y of fld z


When NO text is selected (we clicked somewhere in the field)
it will return the same, but this time: y = x - 1

So we can know exactly where the cursor blinks...

...
put the selectedchunk into hereweare
if word 4 of hereweare > word 3 of hereweare then
    ## no selection, just a blinking cursor...
end if
...

Hope this helped...(?)

> Regards, thierry

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the use-livecode mailing list