realbasic-nug
[Top] [All Lists]

Entering CR/LF into an EditField

To: REALbasic-NUG <realbasic-nug@lists.realsoftware.com>
Subject: Entering CR/LF into an EditField
From: Kem Tekinay <ktekinay@mactechnologies.com>
Date: Sun, 28 Dec 2008 17:31:25 -0500
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
Thread-index: AclpPARt6q9vqOVR80WUCrnteEbhtQ==
Thread-topic: Entering CR/LF into an EditField
User-agent: Microsoft-Entourage/12.15.0.081119
This may be a case where the built-in control is a little too smart...

I want to display raw data in an EditField, and sometimes that data might
contain a CR/LF combination. Unfortunately, in those cases, RB replaces that
combo with just a single CR (on a Mac), so this is what I did: I split the
string by LF, then used fld.AppendText to enter the string in chunks, each
followed by a LF until the last chunk. Was there an easier way?


 if txt.Contains( crlf ) then
  dim arr( -1 ) as string = split( txt, lf )
  dim lastIndex as Int32 = arr.Ubound - 1
  for index as Int32 = 0 to lastIndex
   fld.AppendText arr( index )
   fld.AppendText lf
  next index
  fld.AppendText arr( arr.Ubound )
 else // no crlf in txt
  fld.Text = txt
 end if

__________________________________________________________________________
Kem Tekinay                                                 (212) 201-1465
MacTechnologies Consulting                              Fax (914) 242-7294
http://www.mactechnologies.com                        Pager (917) 491-5546

  To join the MacTechnologies Consulting mailing list, send an e-mail to:
           mactechnologies_consulting-subscribe@yahoogroups.com









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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


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