realbasic-nug
[Top] [All Lists]

Re: TextHeight in EditField

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: TextHeight in EditField
From: David Linker <dtlinker at u dot washington dot edu>
Date: Sun, 30 Apr 2006 14:14:41 -0700
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <DFFFED35-C21B-4028-AF53-3162B4785C5F at u dot washington dot edu> <551962B9-BEA7-40CE-A90B-C6495C85F86C at declareSub dot com>
Thank you. That was it, and it works.

DTL

On Apr 30, 2006, at 6:40 AM, Charles Yeomans wrote:


On Apr 30, 2006, at 1:21 AM, David Linker wrote:

I think there must be an elegant way of doing this, but it escapes me.

I want to dynamically resize an editfield based on the text placed in it. Currently I use the textsize + 4 as an estimate of the height, and find the last line of the text and multiply.

I think that using TextHeight would be more accurate, but it appears only to be a property of a Graphics object, and I can't find a way of recovering the graphics object either of the editfield or it's enclosing window.

I would like this to be flexible, and cross-platform, if it is not horrendously difficult.


Here is a function that returns the text height.

Function TextHeight(fontName as String, fontSize as Integer) as Integer
  dim p as new Picture(1, 1, 32)
  If p.Graphics is nil then //file a bug report
    Return 0
  End if
  p.Graphics.TextFont = fontName
  p.Graphics.TextSize = fontSize
  Return p.Graphics.TextHeight
End Function

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Sun 30 Apr 2006 16:17:29 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
Received: from lists.realsoftware.com (209.198.132.125) by realsoftware.com
with ESMTP (Eudora Internet Mail Server 3.1.3);
Sun, 30 Apr 2006 17:17:47 -0500
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id 331441231960; Sun, 30 Apr 2006 17:17:36 -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 jareth.dreamhost.com (jareth.dreamhost.com [66.33.198.201])
        by lists.realsoftware.com (Postfix) with ESMTP id 112CE1231951
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 17:17:30 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
        by jareth.dreamhost.com (Postfix) with ESMTP id 01D8F191065
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 15:17:28 -0700 (PDT)
Date: Sun, 30 Apr 2006 16:17:29 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <E58B0E8F-A14B-47CC-9757-0800AD066385 at mac dot com>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060430221728 dot 01D8F191065 at jareth dot dreamhost dot com>
Subject: Re: SaveAsDialog OS X RB2006
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

Tony Spencer wrote:
Seems this thread had got a little out of hand!

I certainly agree with that, which is why I've quit contributing to it, but I 
do feel the need to respond to this:

It is quite surprising that Joe is of the opinion that Mac apps don't have pull downs in the Open menu. Although he no longer works for RS, it wasn't that long ago since he did, so if he thinks that way, it's a fairly sure bet RS thinks that way too. And we have shown that this is not a trick used by MS or Adobe, because Apple and third party shareware apps also use pull downs.

All I wrote was, in response to the assertion that Save As dialogs should have a pop-up 
menu to select what file types you want to see: "That's not the case on the Mac (at 
least, in my experience)".  I stand by that.  Most of the apps I frequently use do 
not have these:

 Firefox: no.
 Preview: no.
 REALbasic: no.
 Eudora: no.
 TextEdit: no.  (It does have an Encoding pop-up, but that's quite different.)
 iChat: no.
 Terminal: no.
 GraphicConverter: yes.

OK, so GraphicConverter has a filter pop-up.  It has a lot of other 
non-standard UI, too (much of it with good reason).  But my point remains: in 
my experience, most Mac apps don't have these, while most or all Windows apps 
do.  Somebody coming from a Windows background might happen to look at one Mac 
app that does have such a pop-up (most likely, something in Office), and then 
think all Mac apps should have them -- and then, if they happen to be Sven, 
start claiming (incorrectly) that REALbasic is trash because its file dialogs 
don't have them.  So I merely pointed out that many Mac apps (most, in my 
experience) don't have them; they are not standard on the Mac as they are on 
Windows.

I'd think this might be useful information to someone relatively new to the 
Mac.  If not, feel free to ignore me.

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Available for custom REALbasic programming or instruction.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Sun 30 Apr 2006 16:22:24 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
Received: from lists.realsoftware.com (209.198.132.125) by realsoftware.com
with ESMTP (Eudora Internet Mail Server 3.1.3);
Sun, 30 Apr 2006 17:22:41 -0500
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id C0C9712319E0; Sun, 30 Apr 2006 17:22:30 -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 jareth.dreamhost.com (jareth.dreamhost.com [66.33.198.201])
        by lists.realsoftware.com (Postfix) with ESMTP id BD30B12319D1
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 17:22:24 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
        by jareth.dreamhost.com (Postfix) with ESMTP id 0D08E190F44
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 15:22:23 -0700 (PDT)
Date: Sun, 30 Apr 2006 16:22:24 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <B1162898-F4F2-4E11-B0E5-88D135D451F5 at xhtmlsoft dot com>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060430222223 dot 0D08E190F44 at jareth dot dreamhost dot com>
Subject: Re: RegExMatch class
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

Sven wrote:
In the REALbasic User's Guide.pdf (Downloaded today) page 343.

SubExpressionStart ... Returns the starting position....

p = myMatch.SubExpressionStart(0)
That was also my hope, but it generate: This method or property does not exists.

True; it was switched a couple of versions ago to SubExpressionStartB, since it 
does return the byte offset, not the character offset (and always has).  Sounds 
like the docs have not caught up on this one.

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Available for custom REALbasic programming or instruction.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Sun 30 Apr 2006 16:23:39 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
Received: from lists.realsoftware.com (209.198.132.125) by realsoftware.com
with ESMTP (Eudora Internet Mail Server 3.1.3);
Sun, 30 Apr 2006 17:23:53 -0500
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id 7D9C01231A10; Sun, 30 Apr 2006 17:23:46 -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 jareth.dreamhost.com (jareth.dreamhost.com [66.33.198.201])
        by lists.realsoftware.com (Postfix) with ESMTP id D400F1231A01
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 17:23:39 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
        by jareth.dreamhost.com (Postfix) with ESMTP id 31529190F44
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 15:23:38 -0700 (PDT)
Date: Sun, 30 Apr 2006 16:23:39 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <C07901A1 dot 2178D%fvanlerberghe at freegates dot be>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060430222338 dot 31529190F44 at jareth dot dreamhost dot com>
Subject: Re: Graphics.DrawRoundRect and scaling
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

François Van Lerberghe wrote:
I'm currently coding some printing routine. In order to take into account
multiple resolution, I use a scaling factor with the drawing methods.
My question is : with the Graphics.DrawRoundRect method, must I apply this
scaling factor to the OvalWidth and OvalHeight parameters too like the code
below ?

Yes, since those parameters indicate the actual height and width of the corner 
ovals, in pixels, and not something scale-neutral like percentages.

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Available for custom REALbasic programming or instruction.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Sun 30 Apr 2006 16:26:26 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
Received: from lists.realsoftware.com (209.198.132.125) by realsoftware.com
with ESMTP (Eudora Internet Mail Server 3.1.3);
Sun, 30 Apr 2006 17:26:44 -0500
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id 0CF2F1231A30; Sun, 30 Apr 2006 17:26:33 -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 jareth.dreamhost.com (jareth.dreamhost.com [66.33.198.201])
        by lists.realsoftware.com (Postfix) with ESMTP id D2A101231A21
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 17:26:26 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
        by jareth.dreamhost.com (Postfix) with ESMTP id 28F75190FB0
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sun, 30 Apr 2006 15:26:25 -0700 (PDT)
Date: Sun, 30 Apr 2006 16:26:26 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <000a01c66b7f$5cb67d80$0200a8c0 at OCS>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060430222625 dot 28F75190FB0 at jareth dot dreamhost dot com>
Subject: Re: Using the LPT Port for robotics
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

Jonathon Bevar wrote:
Ok, here's the deal my old Rapid-Q compiler could use the old QuickBasic commands of INP and OUTP to control the LPT or Parallel port with. I need to know the following:

1> Can RB do that or is there some class or plug in that I need to use with it?.

I believe that LPT is just a serial port.  So the Serial class would speak to 
that.  I don't think RB has direct support for the Parallel port, but if I'm 
wrong, hopefully somebody with more experience in Windows will correct me.

2> Or, is there a Serial Port version out there I could use without much fuss or muss?

Version of what?  I'm not sure what you're asking here.  RB has had serial 
support built-in since prehistoric times.

3> Or, is there someone that has got a USB solution to this age old question of the OLD and Tired out LPT and Serial ports?

On the Mac, we (who do robotics-type stuff) frequently need to control serial 
devices from machines that have only USB ports.  Keyspan makes good 
USB-to-serial converters; I imagine these would work well on a PC too.

HTH,
- Joe

--
Joe Strout -- joe at strout dot net
Available for custom REALbasic programming or instruction.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>