I am building a display dialog dynamically and ran across an odd behavior with %ws.
It would appear that the character string being output is first being truncated (using something like trim()) and then that result is being used and subjected to the width parameter for %ws. The code below will demonstrate this behavior.
As a temp fix, I am examining the last character being output and, if it is a blank, then using '%ws ' versus the simple '%ws'. Not a perfect fix, but workable for now.
use mswin
integer k
character*40:: text1='Start of text',text2='end of text '
k = winio@('%ww[topmost,no_maxminbox,no_sysmenu,independent]%fn[Courier New]%bg&',rgb@(255L,255L,255L)) ! very small border ! casts_shadow,topmost,thin_border,no_caption
k = winio@('1::%ws::This is as expected, displayed=as selected%nl&',text1(1:13))
k = winio@('2::%ws::This should have 80 characters between ::%nl&',text1)
k = winio@('3::%13ws::As expected%nl&',text1(1:13))
k = winio@('4::%14ws::As expected%nl&',text1(1:12))
k = winio@('5::%-14ws::Not left justified%nl&',text1(1:14))
k = winio@('6::%-12ws::Not left justified%nl&',text2(1:12))
k = winio@('%bt[Done]')
end