text widget, how to get line number of first line displayed 
Author Message
 text widget, how to get line number of first line displayed

I see where I can get the height of the text widget (in lines), but how
do I know which is the first one displayed?

Thank you.

------------
Scott Mattes

http://www.*-*-*.com/

Sent via Deja.com
http://www.*-*-*.com/



Mon, 30 Jun 2003 03:39:22 GMT  
 text widget, how to get line number of first line displayed

pixel in the text widget, relative to the upper left corner.

So


gives you the first line number in the firstline variable


give you of course the last line.

Hope this helps.

Ludwig

Quote:

> I see where I can get the height of the text widget (in lines), but how
> do I know which is the first one displayed?

> Thank you.

> ------------
> Scott Mattes

> http://www.geocities.com/ScottMattes

> Sent via Deja.com
> http://www.deja.com/

--


Senior Software Engineer        Frontier Design, Belgium
__________________________________________________________________



Mon, 30 Jun 2003 16:57:44 GMT  
 text widget, how to get line number of first line displayed
Hello Scott,

Quote:
> I see where I can get the height of the text widget (in lines), but how
> do I know which is the first one displayed?

You should state the question a little bit different, and then you
could translate it directly into Tcl:

# What index (a line.column pair) is at the text-widget relative coordinate 0,0?
# If found, look at the line related information of the index just before the dot.

proc getTopLineNo {t} {

  return [lindex [split $idx .] 0]

Quote:
}

Greetings, Krischan
--
Christian Krone, SQL Datenbanksysteme GmbH


Mon, 30 Jun 2003 15:36:34 GMT  
 text widget, how to get line number of first line displayed
Thank you, that is what I wanted (and now that I know the answer I can see
it clearly stated in the book, duh).


Quote:
> Hello Scott,

> > I see where I can get the height of the text widget (in lines), but how
> > do I know which is the first one displayed?

> You should state the question a little bit different, and then you
> could translate it directly into Tcl:

> # What index (a line.column pair) is at the text-widget relative
coordinate 0,0?
> # If found, look at the line related information of the index just before
the dot.

> proc getTopLineNo {t} {

>   return [lindex [split $idx .] 0]
> }

> Greetings, Krischan
> --
> Christian Krone, SQL Datenbanksysteme GmbH



Mon, 30 Jun 2003 22:28:06 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. TK question: Getting contents of text widget with line breaks as displayed

2. Text widget --screen lines vs. text lines

3. First line missed when searching in text widget

4. number of lines displayed in text

5. displayed lines in a text widget

6. Moving up/down one DISPLAY line in text widget

7. number of lines in text widget

8. Query number of visible lines in text widget?

9. line numbers/bookmarks with the text widget

10. WANTED: Example of adding line numbers to a text widget

11. How can I trap the line number of a mouse click on a text widget

12. Number of lines in a text-widget

 

 
Powered by phpBB® Forum Software