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.
1) You need it to be invertible for use with Copy/Paste.
2) There is no correct number of spaces to insert: the whole point is
that it varies its width on display. For example, entering text on
the left of a tab does not move the tab point (until it gets past).
3) Tabs work just fine with variable width fonts and help to remove
much of the "variableness."
Craig
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
From Wed 28 Mar 2007 13:06:35 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
id 4BFEF1D4FA88; Wed, 28 Mar 2007 12:06:48 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
www.realsoftware.com
X-Spam-Level:
X-Spam-Status: No, score=-2.8 required=4.5 tests=ALL_TRUSTED,AWL,BAYES_00,
NO_REAL_NAME autolearn=ham version=3.1.1
Received: from lists.realsoftware.com (m.realsoftware.com [66.116.103.65])
by xmail.realsoftware.com (Postfix) with ESMTP id 617001D4FA6E;
Wed, 28 Mar 2007 12:06:45 -0700 (PDT)
Received: from real-software-mini.local (localhost [127.0.0.1])
by lists.realsoftware.com (Postfix) with ESMTP id 67D3D196E69;
Wed, 28 Mar 2007 14:06:39 -0500 (CDT)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from mail.verex.com (mail.verex.com [66.116.103.197])
by lists.realsoftware.com (Postfix) with ESMTP id 20FCC196E5E
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 28 Mar 2007 14:06:35 -0500 (CDT)
Received: from [66.116.103.197] (localhost [127.0.0.1])
by mail.verex.com (Postfix) with SMTP id 4905F721D36
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 28 Mar 2007 13:06:35 -0600 (MDT)
Date: Wed, 28 Mar 2007 13:06:35 -0600
Subject: Re: A way to get half-decent tabs in an RB EditField
From: joe at strout dot net
To: realbasic-nug at lists dot realsoftware dot com
In-Reply-To: <A933538C-7E21-4168-81C8-AAF53F5911D1 at tolisgroup dot com>
X-Mailer: VerEx Email Gateway
Message-Id: <20070328190635 dot 4905F721D36 at mail dot verex dot com>
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com
On Mar 28, 2007, at 18:05 UTC, Tim Jones wrote:
> How about using the regular space character so that you're not tied
> to a specific font?
But the whole point of this hack was to get something wider than the
space character (which neither the tab character, nor the space
character, is).
> 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
I've tried that in the past, but it's *really* hard to do a good
impression of a tab that way. In particular, when the user is
selecting text with the mouse, they can easily cut your fake tabs into
pieces.
Best,
- Joe
--
Joe Strout -- joe at strout dot net
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|