- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using Intel compiler with Visual Studio in a Windows 11 environment. One of my dialogs, created with the dialog editor of VS has two edit boxes, one is only a single line and provides the headline for the second. Both are created with the same styles with 'accept tabs' included.
With my code (see below) I set the tabs position and create strings wherein the places of the tabs are marked by '\t'. The headline-string works fine, however the strings I compile to enter in the listbox below do not. Though for all Iknow, both strings are identical in terms of deployment of \t and the char(0) at the end.
iRslt = SendMessage (hControllistHeader, LB_RESETCONTENT, 0, 0) ! Überschriftzeile löschen
iRslt = SendMessage (hControllist, LB_RESETCONTENT, 0, 0) ! Liste löschen
! Tabulatore setzen
iTabs = (/50,80,110,140,200/) ! ergibt jeweils das 1,5-Fache in Pixel!
iRslt = SendMessage (hControlListHeader, LB_SETTABSTOPS, 4, loc (iTabs))
iRslt = SendMessage (hControllist,LB_SETTABSTOPS, 4, loc(iTabs))
cText = 'Ort\tBetrieb\tPNenn [MW]\tBrennst.\tRolle'C
iRslt = SendMessage (hControllistHeader, LB_ADDSTRING, 0, loc(cText))
do j = 1, iiNPower
cText = trim (ttWerke(j).cOrt) ! 'Aalen'
if (ttWerke(j).lIsOnline) then
cText = trim(cText)//'\tIn Betrieb\t'
else
cText = trim(cText)//'\tStillstand\t' ! 'Aalen\tStillstand\t'
endif
write (cRslt,'(i4)') int (ttWerke(j).rPNenn)
cText = trim(cText) // trim(cRslt)// '\t' ! 'Aalen\tStillstand\t 15\t'
cText = trim (cText) // trim (ttWerke(j).cTraeger)//'\t' ! 'Aalen\tStillstand\t 15\tErdgas\t'
cText = trim (cText) // trim (ttWerke(j).cRolle)//char(0) ! 'Aalen\tStillstand\t 15\tErdgas\tHKW'C
iIndex = SendMessage (hControllist, LB_ADDSTRING, 0, loc(cText)) ! Eintrag hinzufügen
iRslt = SendMessage (hControlList, LB_SETITEMDATA, iIndex, j) ! Den realen Index mitgeben
enddo
I added what I think the string would look like as comments at the end of the lines.
What is wrong? I could not find any reference neither in the intel nor in the VS docs. Any ideas?
Cheers
PF
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you expecting '\t' to be an actual tab character as it would be in C? It doesn't work that way in Fortran. You could use ACHAR(9) or C_HORIZONTAL_TAB from intrinsic module ISO_C_BINDING.
I'll comment that small code excerpts aren't useful in diagnosing problems, and to be honest I don't quite understand your description of the symptom.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve.
Sorry for my clumsy description here. Take a look at my image: The headline works as it should, that is, the text behind a '\t is printed starting at the next tab.
In the next line, to my understanding in the exact same format in a listbox with the exact same styles (as far as I know that is) the '\t's are printed as if they were ordinary parts of the string and the tabs are ignored.
As far as I know, win32 is coded in C, so I think that is the environment, the '\t should work in, not in FORTRAN.
But I'll try with this ACHAR(9).
Thanks again.
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sort of what Steve said, but when you have "String\tString2"C the compiler is using and intel extension to treat it in a C way. But in your other instances it is being treated in the Fortran way so use Achar(9) or I think .....trim (cText) // trim (ttWerke(j).cTraeger)//'\t'C might work for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your lines 17-19, the \t will NOT be translated to a tab. The one in line 7 will be because it's in a C-string (an extension).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay, thats it. ACHAR(9) works. So I understand a C-String is not just a FORTRAN-String with a char(0) pasted to the end but something different.
Thanks to all f you.
Cheers
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Correct - in addition to the NUL padding, a C-string supports many of the typical C backslash sequences. Again, this is an extension.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page