Multiline messages

Multiline messages

I have small dialog project with an edit control into which I want to post formatted multi-line messages with place holders.  For example, a message might be:

6 Files were successfully loaded.

File Stub: (some string)

where bold text represent dynamic content. I tried write statements to a character variable with slashes (/) - that generates and error -forrtl: severe (27): too many records in I/O statement.  I thought of using a resource in a string table like "%n Files were successfully loaded.\nFile Stub: %s", but not sure how to use LoadString to supply the variables as arguments to fill in the % place holders.

Any suggestions?


5 posts / 0 new

Insert CR-LF pairs into the string where you want line breaks. (Use A format.) Internal I/O won't do this for you on record boundaries (that starts a new array element.) 

Steve (aka "Doctor Fortran") - Retired from Intel

Thanks Doc. I tried a number of things but haven't been successful (and thick apparently). I've attached captures of the dialog, properties and results of a test

This was one attempt to create two strings and concatenate them in DlgSet().

character(len=max_name_length):: stub, tempstr1, tempstr2
write(tempstr1,'(i2," RWB Files Selected Successfully")') nfiles
write(tempstr2,'("File Stub:",A15)') TRIM(stub)
retlog = DlgSet(gdlg, IDC_EDIT_PROCESS_RESULTS,TRIM(tempstr1)//char(10)//char(13)//TRIM(tempstr2)//char(0))

The results for one test should be:

8 RWB Files Selected Successfully

File Stub:        LFNL_R4      



Downloadimage/png dialog.png21.92 KB
Downloadimage/png props.png34.08 KB
Downloadimage/png test.png17.94 KB

Best Reply

Swap the char(..)'s

CRLF is char(13)//char(10)
LFCR is char(10)//char(13)

Generally from a console app (CMD window), the order of CR and LF does not matter.

Windows dialog box may be goofy in this respect.

Jim Dempsey


 Jim - thank you.  Definitely goofy.



Downloadimage/png yes.png4.75 KB

Leave a Comment

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