Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Multi-Line Edit Box

dzallar
Beginner
699 Views
Can someone please tell me why the following code is not writing a multiline edit box? I have selected the multiline options in properties.
write (text, '(f6.4)') sigma
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(13)//char(10))
write (text, '(f6.4)') delta
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(13)//char(10))
write (text, '(f6.4)') theta
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(13)//char(10))
write (text, '(f5.1)') Temp
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(13)//char(10))
write (text, '(f6.3)') Press / 144
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(13)//char(10))
write (text, '(ES10.3)') Rho * 32.172
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(13)//char(10))
write (text, '(f8.3)') C
lret = DlgSet(dlg, IDC_EDIT_TEST, text)
Thank you,
David
0 Kudos
3 Replies
paulcurtis
Beginner
699 Views
The content of an edit box has no concept of multiple "lines", it's only a single contiguous buffer. If the buffer content contains crlf, this is interpreted as "start a new line" when the (printable) text is printed in the box (ie, the multiline flag has been checked).
Hence you want to createone big buffer, fill it all in advance, and then write it once to your editbox, eg
character(len=300) :: text
character(len=2), parameter :: crlf = char(13)//char(10)
...
write (text,'(10(F6.4,A))') sigma,crlf,delta,crlf,theta,crlf,temp.... etc.
lret = DlgSet(dlg, IDC_EDIT_TEST, text//char(0))
Altho off-topic, I mustcomment thatthis would not be a very "friendly" or useable GUI; much better to have separate small data entry controls for each variable, if the idea is that they can be changed independently by the user. Also makes the coding much clearer, easier to maintain, etc.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
699 Views

To David: it is possible to append to existing multi-line box without your own bookkeeping, but you have to use Win32 APIs. (Actually, DlgSendCtrlMessage + EM_* nessages). See this recent thread.

Jugoslav

0 Kudos
dzallar
Beginner
699 Views

Thanks, I finally got it to work the way I want.

David

0 Kudos
Reply