Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with TCL scrolledtext function

Status
Not open for further replies.

dcarp

Programmer
Mar 6, 2007
6
US
I have a working scrolledtext iwidget (TCL extension) which works wonderfully for capturing data through my serial port, COM1 on my PC. Infact, the scrolled data works just like Hyperterm does except for the scrollbar. The scrollbar scrolls up as data streams in, so I have to manually drag the scrollbar down in order to view the most recent data. I noticed that forcing a manual <CR> from the keyboard will do as expected, i.e. keep the scrollbar pointer in the down position for viewing the last data received. I was unable to add a "\xd" (newline) in code to help correct this problem when receiving data through COM1 port. Does anyone have a suggestion for resolving this issue? I've tried various options, but no dice.
 
Perhaps the see command will do what you want:
pathName see index
Adjusts the view in the window so that the character given by index is completely visible. If index is already visible then the command does nothing. If index is a short distance out of view, the command adjusts the view just enough to make index visible at the edge of the window. If index is far out of view, then the command centers index in the window.

_________________
Bob Rashkin
 
Thanks Bong for the information.
I believe you were referencing the 'seek' command. I called up the man page for the command synopsis: seek channelId offset? origin?
Example code:
set f [open file.txt]
fconfigure....
set data1 [read $f]
seek $f -10 end (or seek $f 0 to repeat)
set data [read $f 10]
close $f

But this does not appear to work with serial ports, like I need. Correct me if I'm wrong or if you have any additional information.
Thanks again!
 
Bong, sorry I misunderstood what you trying to convey to me.
This suggestion was in from another site and it works great!
After each insert of new text into the window, execute the text widget
commmand:

$textwindow see end

or

$textwindow see insert

This should move the view so the user "sees" the mark (end or index).

-Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top