Crossplatform new line character

I need to split a caption of a TCheckBox in two lines at a specific place.
So, I set CheckBox1.WordWrap to True, adjust its height and sofar OK, if the text is long enough,
it wraps to a second line.

Q1: I can't figure out how to enter a carriage return, line feed or both in the object inspector.
Is it possible?

A workaround is to define a string const:
const
  CR = #$0D;
  cbCaption = 'The text that needs to' + CR + 'wrap around';
and then in the forms OnCreate assign it to CheckBox1.Caption

I also tested with LF = #$0A and CRLF = CR + LF, and on Windows all of these work.

Q2: For compatibility with possible future crossplatform porting of the code (to OSX, iOS and
Android), which new line character would be best, CR, LF or CRLF?

-- 
Tom Brunberg
firstname.lastname@welho.com
0
Tom
4/2/2014 10:04:48 AM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

8 Replies
1954 Views

Similar Articles

[PageSpeed] 34

Tom Brunberg wrote:

> Q1: I can't figure out how to enter a carriage return, line feed or
> both in the object inspector.

Have you tried copy/paste multiline text from some external editor?

JVCL has custom editor for string properties in OI. It adds [...]
button which shows an editor like Memo.Lines. After editing multiline
text has new line chars (0a+0d) which look as squares in OI.

-- 
Alex
0
Alex
4/2/2014 10:19:16 AM
Tom Brunberg wrote:

> I need to split a caption of a TCheckBox in two lines at a specific
> place.  So, I set CheckBox1.WordWrap to True, adjust its height and
> sofar OK, if the text is long enough, it wraps to a second line.
> 
> Q1: I can't figure out how to enter a carriage return, line feed or
> both in the object inspector.  Is it possible?

For a regular caption that doesn't let you enter multiple lines, you
could edit the .dfm (view as text), enter the text with the line breaks
directly and then switch back (View as Form).

Caption = 'The text that needs to'#13#10'wrap around'


> A workaround is to define a string const:

Given the choice, I would probably do it this way.


> Q2: For compatibility with possible future crossplatform porting of
> the code (to OSX, iOS and Android), which new line character would be
> best, CR, LF or CRLF?

Use the constant "sLineBreak", which takes care of this for you.

-- 
Regards,
Bruce McGee
Glooscap Software
0
Bruce
4/2/2014 11:22:12 AM
Alex Belo wrote:

> Tom Brunberg wrote:
> 
> > Q1: I can't figure out how to enter a carriage return, line feed or
> > both in the object inspector.
> 
> Have you tried copy/paste multiline text from some external editor?

Thanks Alex. No, I haven't, until now.
It would have been too simple :), unfortunately it doesn't work. It seems the IDE cuts off the
second line (in D2010, I did not try with XE5)

> JVCL has custom editor for string properties in OI. It adds [...]
> button which shows an editor like Memo.Lines. After editing multiline
> text has new line chars (0a+0d) which look as squares in OI.

That would be a nice feature

-- 
Tom Brunberg
firstname.lastname@welho.com
0
Tom
4/2/2014 2:34:39 PM
Bruce McGee wrote:

> Tom Brunberg wrote:
> 
> > I need to split a caption of a TCheckBox in two lines at a specific
> > place.  So, I set CheckBox1.WordWrap to True, adjust its height and
> > sofar OK, if the text is long enough, it wraps to a second line.
> > 
> > Q1: I can't figure out how to enter a carriage return, line feed or
> > both in the object inspector.  Is it possible?
> 
> For a regular caption that doesn't let you enter multiple lines, you
> could edit the .dfm (view as text), enter the text with the line breaks
> directly and then switch back (View as Form).
> 
> Caption = 'The text that needs to'#13#10'wrap around'

Thanks Bruce. Ah yes, didn't think of that.

> > A workaround is to define a string const:
> 
> Given the choice, I would probably do it this way.
> 
> 
> > Q2: For compatibility with possible future crossplatform porting of
> > the code (to OSX, iOS and Android), which new line character would be
> > best, CR, LF or CRLF?
> 
> Use the constant "sLineBreak", which takes care of this for you.

Thanks for that, I didn't know it existed. Found it now in System.pas (XE5) defined as
_AnsiChar(#10) on POSIX and _AnsiStr(#13#10) on MSWINDOWS.

What does POSIX actually stand for? OSX and LINUX?
How do _AnsiChar and/or _AnsiStr work on mobiles?


-- 
Tom Brunberg
firstname.lastname@welho.com
0
Tom
4/2/2014 2:34:40 PM
Tom Brunberg wrote:

> What does POSIX actually stand for? OSX and LINUX?

Here are the predefined conditionals and which platforms they are
defined on.  Basically, everything that isn't Windows.

http://docwiki.embarcadero.com/RADStudio/XE5/en/Conditional_compilation_%28Delphi%29


> How do _AnsiChar and/or _AnsiStr work on mobiles?

I don't know.

-- 
Regards,
Bruce McGee
Glooscap Software
0
Bruce
4/2/2014 4:27:48 PM
Bruce McGee wrote:

> Tom Brunberg wrote:
> 
> > What does POSIX actually stand for? OSX and LINUX?
> 
> Here are the predefined conditionals and which platforms they are
> defined on.  Basically, everything that isn't Windows.
> 
> http://docwiki.embarcadero.com/RADStudio/XE5/en/Conditional_compilation_%28Delphi%29

Thanks Bruce!

> > How do _AnsiChar and/or _AnsiStr work on mobiles?
> 
> I don't know.

OK, I'll find out later.

Cheers

-- 
Tom Brunberg
firstname.lastname@welho.com
0
Tom
4/2/2014 5:29:46 PM
> {quote:title=Tom Brunberg wrote:}{quote}

> What does POSIX actually stand for? OSX and LINUX?

POSIX stands for "Portable Operating System Interface" and is a collection of standards to allow compatibility across different operating systems. OS/X is fully POSIX compliant and Linux is mostly POSIX compliant depending on the distro. Windows, of course, is the oddball out as usual :-). That said, Cygwin can give you a mostly POSIX-compatible environment on Windows and Microsoft makes a similar product (SFU).
0
Joseph
4/2/2014 6:20:44 PM
Joseph Mitzen wrote:

> > {quote:title=Tom Brunberg wrote:}{quote}
> 
> > What does POSIX actually stand for? OSX and LINUX?
> 
> POSIX stands for "Portable Operating System Interface" and is a collection of standards to allow
> compatibility across different operating systems. OS/X is fully POSIX compliant and Linux is
> mostly POSIX compliant depending on the distro. Windows, of course, is the oddball out as usual
> :-). That said, Cygwin can give you a mostly POSIX-compatible environment on Windows and
> Microsoft makes a similar product (SFU).

Thanks Joseph for the information.

-- 
Tom Brunberg
firstname.lastname@welho.com
0
Tom
4/3/2014 12:36:37 PM
Reply:

Similar Artilces:

How to force a new line to keep one line only have 10 characters?
For example, user may input text as below: AAAAAAAAAABBBBBBBBBBCCCCCCCCCC But to make it as: AAAAAAAAAA BBBBBBBBBB CCCCCCCCCC string wholeLine = "AAAAAAAAAABBBBBBBBBBCCCCCCCCCC";List<string> lines = new List<string>();while ( wholeline.Length > 0){    if (wholeline.length >= 10)    {        lines.Add( wholeline.Substring(0, 10);        wholeline = wholeline.Substring (10);    }    else    {       &nb...

New line character
I am writing code (VS2008/C#) that reads text file and passes the file data to SQL Server Procedure. I am reading data of file in StreamReader and passing as Input Parameter to procedure. I need to pass the New Line character also to the procedure. 1. The New Line character can be chr(13) & chr(10) or only chr(10). How to check this in C#?2. How to pass New Line character to SQL Procedure? Thanks    Try using Environment.NewLine Hanan Schwartzberg--------------------http://www.lionsden.co.il Environment.NewLine returns the new line defined in the environment. I nee...

New Line Character
i using mysql connect to database and found data like "abcde fgh" how to convert this string from two line into one line? and result become "abcdefgh"  hello friend, suppose your string is called myString= "abcde fgh" and then use myString.Replace(System.Enviornment.NewLine,"") hope it helps, Jessica  Jessica CaoSincerely,Microsoft Online Community Support“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other comm...

new line character
Is there a way to insert a "new line/carriage control" in a varchar column? <Ctrl><Enter> keys work with a text column but just tabs to next control on a varchar column. Tried ~r~n but that just stores/prints the text ~r~n. Seems that <ctrl><enter> used to work in the app. PB 7.02 9028 You can use char(10) + char(13) to get the cr/lf -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your post. MySybase http://my.sybase.com/mysybase Search Deja: http://www.pfcguide.com/_newsgroups/search.asp <Mike> wrote in message...

New Line character in a String
I want to create a string which contains a new line character. In Powerbuilder, I would use '~n' but what do I use within a stored procedure in ASE 12.0? I'm trying to create a mulit-line error message that is passed back from the stored procedure to the Powerbuilder front-end. select @message = 'Line1~n Line 2 ~n Line 3" should display like this: Line 1 Line 2 Line 3 Thanks! select @message = "Line 1" + char(10) + "Line 2" + char(10) + "Line 3" select @message RM wrote: > I want to create a string which co...

New Line Character(s)
Greetings. I've got some Perl code that's inserting data into a MySQL, which is later being read & displayed by MS Access. I'm constructing a note, and I'm using: \n for new lines - to break up paragraphs. However, in Access, these \n characters appear as little boxes instead of new lines. What should I use to get Access to display a new line? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: dkasak@nusconsulting.com.au website: http:...

new line character in the validation
Hi, I have a radiobuttonlist repeatdirection horizontally, and I have a requirefieldvalitor against this field with *. However, when the user miss the field and a red * is outputed, but it goes to the next line. I want them to be on the same line. How can I do that? Thanks. post some code? There may not be enough space on the line for it to go there so it automatically goes to the next line Actually there are still a lot of space on the line. here's the code.  <asp:RadioButtonList ID="GenderSelect" runat="server" RepeatDirection="Horizontal" ...

New line character in XML
HI Friends, I am in a deep trouble. If u help me in this issue, it will be greatful. Requirement is as below. I am having a grid which will be bind to a datatable. i will have to show tooltips on the column headers of this gridview. I have an XML file which contains the content for these tooltips. i have written a method which takes a string as a parameter, which is the column name of the gridview. Based on this string that we have passed, the method will pick the content for the tooltip from the XML file and display. But i have a problem here. Here the content of the tooltip can ...

how to skip new line character
------=_NextPart_000_0015_01C49666.30D23690 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi All As a beginner in PERL, I wrote a small program which reads data from the = file and stores in an array. In that process i wanted to skip the new = line character... for ex: In my program say "a.txt" contains man pan tan In the program open INPUT,"a.txt" or die $!; my @file =3D <INPUT>; when I print the file, I could see $file[2] and $file[4] has only new = line character... So while...

ASCII import
I am importing ascii text files to tables in an whatcom 4 db. For some big text fields i need to put a "newline" character in order to get a new line in i.e varchar fileds. I have tried � ~n with no success. any postings will be appreciated. Per H. Kleppe Try using \n. Watcom/SQL Anywhere reads the C special print characters, sometimes when you don't want it to. -- Jim Egan [TeamPS] Dealer Solutions, LLC Houston, TX This is a multi-part message in MIME format. ------=_NextPart_000_0005_01BCD822.8928C750 Content-Type: text/plain; charset="iso...

add a new line character in label
How do i add a new line character in a label content? I tried system.environment.newline and it doesn't work. "<br/>"LolliDon't forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. Hi, try this  lbl1.Text = lbl1.Text+ "<br />" Public Shared Function BrakeRow(ByVal _count As Integer) As LiteralControl Dim tmp As String = "" Dim i As Integer For i = 0 To _count ...

new line is changed in space character
Hallo, when I submit the data of a multiline textarea the new line is changed into a space character. If the user write: A B C The text will be displayed as: A B C I am using a datalist with parameter stored procedure, Access 2003 DB. Do you have a solution? Thanks   before you send in the data you can do something like : txtstmtbdy1.text.replace(environment.newline,"<br>")  to preserve the newline's.***********************Dinakar NethiLife is short. Enjoy it.***********************...

New line character in email notifications
Quick question...... How do you insert a new line in an email sent by Identity Manager? I am sending an email with user information and would like to have the info on separate lines, instead of separated by comas. I think I have seen this answer before somewhere on the Novell site, but I cant find it now. Anyone know? Thanks for any response, Jordan http://tinyurl.com/s3oey -- Father Ramon jcocke1@dot.state.tx.us wrote: > Quick question...... How do you insert a new line in an email sent by > Identity Manager? I am sending an email with user information and...

new line character in a result set
Hi I try this select 'First line:\nSecond line:';output to d:\temp\test.txt and the result is'First line:\x0ASecond line:'Tried with char(10)+char(13).How can I make the result set that:First lineSecond LimeTIARegardsVesselin First Line Second Line .... .... TIA "Veselin Ivanov" <vs@sonita.com> wrote in message news:42d6ab50@forums-1-dub... > Hi > I try this > select 'First line:\nSecond line:';output to d:\temp\test.txt and the > result is'First line:\x0ASecond line:'Tried with char(10)+char(13).How can...

Web resources about - Crossplatform new line character - embarcadero.delphi.general

Zipline adds funding for Moai crossplatform tools
As more developers jump onboard, Zipline finds $750,000 in additional funding Zipline Games has acquired new funding to improve and expand its ...

CNN Profiles - Chris Boyette - Crossplatform Planning & Special Projects - CNN.com
Chris Boyette writes for CNN Digital and can be found both behind and in front of the camera.

Eyes-on with Mad Catz' GameSmart crossplatform gaming peripherals
You've already learned all about Mad Catz' latest line of gaming peripherals part of its new GameSmart crossplatform Bluetooth initiative but ...

Microsoft acquires Wunderlist creator, adding to its crossplatform productivity offerings, report says ...
Microsoft has reportedly acquired Berlin-based 6Wunderkinder, creator of the to-do list app Wunderlist. The app joins Acompli and Sunrise in ...

Space Shooter Blitz for iPhone, iPod touch, and iPad on the iTunes App Store
Get Space Shooter Blitz on the App Store. See screenshots and ratings, and read customer reviews. The now-infamous “A Space Shooter” franchise, ...

AnyPresence - CrunchBase Profile
AnyPresence is a mobile development platform that dramatically reduces the time and cost of mobile-enabling enterprise business processes, products, ...

Android puzzle - Flickr - Photo Sharing!
Android is turning from a mobile operating ysstem in to a cross platform runtime environment for applications. Here's a post about it: blogg ...

James Dator (@James_Dator) on Twitter
Sign in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here James Dator @ James_Dator ...

Video game development - Wikipedia, the free encyclopedia
Video game development is the generally involved and lengthy process of creating a video game . Development is undertaken by a game developer ...


Resources last updated: 12/21/2015 6:55:17 AM