[ltk-user] Entry index
mandeep singh
lassiholik at gmail.com
Tue May 8 23:04:01 UTC 2007
Sorry Vadim you were right in the first place - i wrote Edit by i
meant the Text widget all along. Thoughtless mistake from me, i'd been
up all night. I am highlighting parts of the text using tags - so i
need to know the line number and character position within the line.
To do this i need to translate from a position in the text string - to
a position in the text widget (line.char). This is where im stuck.
i thought to write my own code but im very new to both tk and ltk so
im not sure how to read the data back from wish.
so far i have something like:
(defun index (text-widget string-index)
(format-wish "~A index {~A}" (widget-path text-widget) string-index)
(read-data))
but after this im stuck. does read-data modify some global variable? i
dont know where it keeps the state even though ive tried reading the
defun itself.
any help appreciated.
On 5/8/07, Vadim <vadim at vkonovalov.ru> wrote:
> mandeep singh wrote:
>
> > If you use tags then you must deal with "line.char" indices - there is no
> > way to refer to parts of the text without doing so. i was using
> > (concantate
> > "1." string-index) for tags before - until i realised it wouldnt hold for
> > lines other than the first one.
>
>
> You're probably mixing "Text" and "Entry"?
> "entry" widget is always one-line in Tcl/Tk
> "text" widget as much lines as you want.
>
> I'm not expert in ltk, but I expect there is 1-to-1 correspondence
> between them
>
> >
> > On 5/8/07, Vadim <vadim at vkonovalov.ru> wrote:
> >
> >>
> >> mandeep singh wrote:
> >>
> >> > i've got a bit of a problem. I need to use the index function of the
> >> > Entry
> >> > widget to get back a line.char structure. but there doesnt seem to be
> >> any
> >> > support for this, yet, so i thought to write it but i dont know the
> >> > procedure to get ouput from wish. any help appreciated. thanks!
> >>
> >>
> >> in Tcl/Tk "Text" widget index has "line.char" but Entry has just
> >> numerical value.
> >> if you insist in having same format, then concatenate it with "1.", but
> >> I don't understand how this could be useful.
> >>
> >> Best regards,
> >> Vadim.
> >>
> >> _______________________________________________
> >> ltk-user site list
> >> ltk-user at common-lisp.net
> >> http://common-lisp.net/mailman/listinfo/ltk-user
> >>
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >ltk-user site list
> >ltk-user at common-lisp.net
> >http://common-lisp.net/mailman/listinfo/ltk-user
> >
>
>
> _______________________________________________
> ltk-user site list
> ltk-user at common-lisp.net
> http://common-lisp.net/mailman/listinfo/ltk-user
>
More information about the ltk-user
mailing list