How do you get a multi-line message box

How do you get a multi-line message box

I can get a multiline message box by including
in the text.

But this doesn't work if I want to buld the message text from a combination of smaller text items.

I'm sure there must be a way to do this.

Thanks,
David

msg='This is line 1
This is line 2'c
iret=MessageBox(0,msg,'Title'c,MB_ICONINFORMATION)
msg='This is line 1
'//'This is line 2'c
iret=MessageBox(0,msg,'Title'c,MB_ICONINFORMATION)

The first example gives:
This is line 1
This is line 2

The second example gives:
This is line 1
This is line 2

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Here's how I do it:

CHARACTER(2), PARAMETER :: CRLF = CHAR(13)//CHAR(10)
...
msg = 'This is line 1'//CRLF//'This is line 2'C

You can even build up the line across several statements like this:

msg = 'This is line 1'
msg = trim(msg)//CRLF//'This is line 2'C

Note that only the last line uses the C string type - alternatively you could concatenate CHAR(0).

Steve

Retired 12/31/2016

Thanks,

David

Leave a Comment

Please sign in to add a comment. Not a member? Join today