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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text widget problem with blanks/spacings 1

Status
Not open for further replies.

fabien

Technical User
Sep 25, 2001
299
AU
Hi!

I have recently found the following problem with the text widget.

If I have the following written in it:

123456789012345678901234567890

123 456 789

If I move the cursor on the first line from 1 to 9 it moves 9 times, normal! However if I move the cursor on the third line to number 3 it has moved 9 times 6 for the blanks and 3 times for the numbers. WHat's happening with the blanks?
How to overcome this?

I need this because I want to be able to find the start/enc column of numbers like the "123" "456" in the above example and there will be blanks between them

Hope this is clear.

 
I don't understand the problem. It looks like there are 2 spaces on line 3 before the "123". Are you saying it takes 3 cursor moves/space?

Anyway, it may have to do with how you put your text in the widget. I did the following by way of an experiment:

pack [text .t]
.t insert end "0123456789abcdef"
.t insert end \n\n
.t insert end " 123 456 789"


If I put the cursor (with the mouse) on the first line, press "home" and start arrowing right, I get 1 character/cursor move. If I arrow down to the 3rd line, press "home", and arrow right, I move 1 character (or space)/cursor move. It seems like normal behavior to me.

Bob Rashkin
rrashkin@csc.com
 
you may want to specify the font used in the text widget to be "fixed". It ensures that all characters, including a space take up the same width and height.

Give that a shot
 
Does setting the text font to a fixed font can help you?
Code:
  text .t -font {Courier 10}
HTH

ulis
 
Great guys this was the problem, many thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top