<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — SF]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=978&amp;type=atom" />
	<updated>2025-03-29T22:38:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=978</id>
		<entry>
			<title type="html"><![CDATA[Re: SF]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=4440#p4440" />
			<content type="html"><![CDATA[<p>Jeff,</p><p>After installing SF 3.40 build 4415 and doing a fresh clean of the old build, the above example Appgraphics dlgrequesttext() function worked perfectly. </p><p>Thank you again for your effort to detail.</p><p>Frank</p>]]></content>
			<author>
				<name><![CDATA[drfrank]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=223</uri>
			</author>
			<updated>2025-03-29T22:38:47Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=4440#p4440</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: SF]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=4439#p4439" />
			<content type="html"><![CDATA[<p>Frank,</p><p><a href="https://simplyfortran.com/download/?platform=windows">Build 4415</a> should fix this problem entirely.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2025-03-29T18:04:18Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=4439#p4439</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: SF]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=4438#p4438" />
			<content type="html"><![CDATA[<p>There are some bugs in AppGraphics here, but I can at least explain the reasoning.&nbsp; The initial text string is immediately trimmed, and a <em>c_null_char</em> is appended to the trimmed string <strong>all within the original text string</strong>.&nbsp; So in your example, your string was:<br /></p><div class="codebox"><pre><code>123456789012345678901234567890</code></pre></div><p>but the box would show only 29 characters:<br /></p><div class="codebox"><pre><code>&quot;12345678901234567890123456789</code></pre></div><p>Now for some reason, the string is shortened again when retrieving the string.&nbsp; This issue is caused by an off-by-one issue when determining the string&#039;s length, causing the retrieved string to only contain 28 characters:<br /></p><div class="codebox"><pre><code>&quot;1234567890123456789012345678</code></pre></div><p>The bug is two-fold:</p><p>1. The retrieval should remain, in theory, at 29 characters and<br />2. The documentation should point out that a <em>c_null_char</em> would be added to the string within the string&#039;s size.</p><p>However, fixing both still wouldn&#039;t truly fix the expected behavior where a Fortran user would expect the full 30 characters to be available and usable.&nbsp; I&#039;ll try to get a fix in today that retrieves the full 30 characters.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2025-03-27T11:34:16Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=4438#p4438</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[SF]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=4437#p4437" />
			<content type="html"><![CDATA[<p>Hi Jeff,</p><p>There appears to be an issue with the way Appgraphics implements dlgrequesttext(). For example, if it is used to enter a text password of exactly the same length as it is dimensioned, then the password is truncated by two characters. This would be problem when trying to enter a correct password since the requested text would not equal the original password. The issue does not occur when the dimension of the entered password text is increased by two characters (dim(text(n + 2)). I&#039;ve attached a simple example below which produces the following results.</p><p>&nbsp; &nbsp; !--- Simply Fortran v3.39<br />&nbsp; &nbsp; !--- OUTPUT: CHARACTER(30) :: txt<br />&nbsp; &nbsp; My initial text is 123456789012345678901234567890<br />&nbsp; &nbsp; My initial text length is&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;30<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Request was successful: T<br />&nbsp; &nbsp; My requested text is&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1234567890123456789012345678<br />&nbsp; &nbsp; My requested ADJUSTL(text) is 1234567890123456789012345678<br />&nbsp; &nbsp; My requested TRIM(text) is&nbsp; &nbsp; &nbsp; 1234567890123456789012345678<br />&nbsp; &nbsp; My requested text length is&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 28<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Initial text does not equal requested text: Failure!</p><p>Regards,<br />Frank</p><p>SF Code:<br />PROGRAM REQUEST_TEXT<br />&nbsp; &nbsp; USE APPGRAPHICS, ONLY: dlgrequesttext, dlgrequestpassword</p><p>&nbsp; &nbsp; IMPLICIT NONE<br />&nbsp; &nbsp; INTEGER, PARAMETER :: n = 30&nbsp; !-- if set to 32, cTXT len_trim = 30<br />&nbsp; &nbsp; CHARACTER(n) :: cTXT, cTEXT<br />&nbsp; &nbsp; CHARACTER(n) :: cTITLE, cLBL<br />&nbsp; &nbsp; LOGICAL&nbsp; &nbsp; &nbsp; &nbsp;:: bYN</p><p>&nbsp; &nbsp; cTITLE = &quot;My Title:&quot;<br />&nbsp; &nbsp; cLBL = &quot;Enter text:&quot;</p><p>&nbsp; &nbsp; cTXT = &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;123456789012345678901234567890&quot;</p><p>&nbsp; &nbsp; cTEXT = TRIM(ADJUSTL( cTXT ))</p><p>&nbsp; &nbsp; PRINT *, &#039;My initial text is &#039;, TRIM( cTXT )<br />&nbsp; &nbsp; PRINT *, &#039;My initial text length is &#039;, LEN_TRIM( cTXT )<br />&nbsp; &nbsp; PRINT *</p><p>&nbsp; &nbsp; bYN = dlgrequesttext( cTXT, cTITLE, cLBL, .FALSE. )<br />&nbsp; &nbsp; !bYN = dlgrequestpassword( cTXT, cTITLE, cLBL )</p><p>&nbsp; &nbsp; IF (bYN) THEN<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;Request was successful:&#039;, bYN<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;My requested text is &#039;, REPEAT(&#039; &#039;,9), cTXT<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;My requested ADJUSTL(text) is &#039;, ADJUSTL( cTXT )<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;My requested TRIM(text) is &#039;, REPEAT(&#039; &#039;,3), TRIM( cTXT )<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;My requested text length is &#039;, REPEAT(&#039; &#039;,3), LEN_TRIM( cTXT )<br />&nbsp; &nbsp; ELSE<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;Request was unsuccessful:&#039;, bYN<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;My requested text is unchanged: &#039;, ADJUSTL( cTXT )<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;My text length is:&#039;, LEN_TRIM( cTXT )<br />&nbsp; &nbsp; END IF</p><p>&nbsp; &nbsp; PRINT *<br />&nbsp; &nbsp; IF (ADJUSTL(cTXT) /= ADJUSTL(cTEXT)) THEN<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;Initial text does not equal requested text: Failure!&#039;<br />&nbsp; &nbsp; ELSE<br />&nbsp; &nbsp; &nbsp; &nbsp; PRINT *, &#039;Initial text equals requested text: Success!&#039;<br />&nbsp; &nbsp; END IF</p><p>&nbsp; &nbsp; RETURN</p><p>&nbsp; &nbsp; !--- OUTPUT:<br />&nbsp; &nbsp; !&nbsp; &nbsp; My initial text is 123456789012345678901234567890<br />&nbsp; &nbsp; !&nbsp; &nbsp; My initial text length is&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;30<br />&nbsp; &nbsp; !<br />&nbsp; &nbsp; !&nbsp; &nbsp; Request was successful: T<br />&nbsp; &nbsp; !&nbsp; &nbsp; My requested text is&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1234567890123456789012345678<br />&nbsp; &nbsp; !&nbsp; &nbsp; My requested ADJUSTL(text) is 1234567890123456789012345678<br />&nbsp; &nbsp; !&nbsp; &nbsp; My requested TRIM(text) is&nbsp; &nbsp; 1234567890123456789012345678<br />&nbsp; &nbsp; !&nbsp; &nbsp; My requested text length is&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 28<br />&nbsp; &nbsp; !<br />&nbsp; &nbsp; !&nbsp; &nbsp; Initial text does not equal requested text: Failure!<br />&nbsp; &nbsp; !<br />END PROGRAM REQUEST_TEXT</p>]]></content>
			<author>
				<name><![CDATA[drfrank]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=223</uri>
			</author>
			<updated>2025-03-26T23:25:11Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=4437#p4437</id>
		</entry>
</feed>
