On Mar 28, 2007, at 9:47 AM, joe at strout dot net wrote:
> So, necessity being a mother and all that, I got inspired to put this
> in the KeyDown event of an EditField:
>
> static fakeTab As String = Encodings.UTF8.Chr( &h2003 )
> if Key = Chr(9) then
> me.selText = fakeTab
> return true
> end if
> return false
>
> Unicode &h2003 is the "Em Space" character. It's a whitespace
> character that's significantly longer than your typical space
> character. The code above intercepts any press of the Tab key and
> inserts an Em Space instead.
How about using the regular space character so that you're not tied
to a specific font? You could then measure the cursor's current
position in characters, do modulus math to compare it against a
tabstop setting and add the appropriate number of spaces (allows user
to specify tabstops - I use 2 in HTML, 4 in C, and 8 in Python).
Also, since spaces and character widths will totally mess up the
layout when using a variable width font, you might consider locking
the font choices to fixed width fonts.
Tim
--
Tim Jones
tjmac at tolisgroup dot com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|