<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Issue appgrafics]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=812&amp;type=atom" />
	<updated>2021-06-11T09:55:32Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=812</id>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3758#p3758" />
			<content type="html"><![CDATA[<p>Hi Jeff,<br />It works great now. Thank you very much!!<br />I must say this compiler is great! I had a look at several Fortran compilers, but this one is for me the best there is!!</p><p>I would like to show you what I created with this compiler, but unfortunately this is not possible.</p><p>Thanks again for your great support!!!</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-06-11T09:55:32Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3758#p3758</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3757#p3757" />
			<content type="html"><![CDATA[<p>The problem is that you need to define a true interface to your <em>noclosewin</em> function.&nbsp; I see that you have it on the integer declaration line, but that isn&#039;t sufficient.&nbsp; If you&#039;re using Fortran 90 modules, it would be easy to scope, but I suspect you are not.</p><p>A solution that might seem ugly now is to change your calling function to be:</p><div class="codebox"><pre><code>      subroutine GRAF()
.
      use appgraphics
      implicit none
.
.
      integer:: ipixxx, ipixyy, winx, winy, iiwin
      character::(20) mnubuf

      interface
            function noclosewin()
            integer::noclosewin
            end function noclosewin
      end interface

.
.
.
      iiwin = initwindow(ipixxx,ipixyy,mnubuf,winx,winy,dbflag=.false.,closeflag=.false.)
.
.
      call setwindowsystemclosecallback(noclosewin)
.
.
      end subroutine GRAF</code></pre></div><p>The above should now make it clear to the compiler that <em>noclosewin</em>, wherever it is in your code, is a function returning an integer.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-06-10T19:24:39Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3757#p3757</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3756#p3756" />
			<content type="html"><![CDATA[<p>To do a simple test I kept it simple and created almost exactly the same function as You did! Only the &quot;print&quot; statement is not in there.<br />&nbsp; &nbsp; &nbsp; function noclosewin()<br />!<br />&nbsp; &nbsp; &nbsp; implicit none<br />!<br />!&nbsp; &nbsp; &nbsp; procedure als window wordt geclosed<br />!<br />!<br />&nbsp; &nbsp; &nbsp; INTEGER::noclosewin<br />!<br />&nbsp; &nbsp; &nbsp; noclosewin = 0<br />!<br />&nbsp; &nbsp; &nbsp; return<br />!<br />&nbsp; &nbsp; &nbsp; END function noclosewin</p><p>But I don&#039;t think the function is the issue.<br />The main source holding the call to the new subroutine gives the error!</p><p>The following lines are amongst others in my mainsource:</p><p>&nbsp; &nbsp; &nbsp; subroutine GRAF()<br />.<br />&nbsp; &nbsp; &nbsp; use appgraphics<br />&nbsp; &nbsp; &nbsp; implicit none<br />.<br />.<br />&nbsp; &nbsp; &nbsp; integer:: noclosewin, ipixxx, ipixyy, winx, winy, iiwin<br />&nbsp; &nbsp; &nbsp; character::(20) mnubuf<br />.<br />.<br />.<br />&nbsp; &nbsp; &nbsp; iiwin = initwindow(ipixxx,ipixyy,mnubuf,winx,winy,dbflag=.false.,closeflag=.false.)<br />.<br />.<br />&nbsp; &nbsp; &nbsp; call setwindowsystemclosecallback(noclosewin)<br />(here the editor presents the error-message!!!)<br />.<br />.<br />&nbsp; &nbsp; &nbsp; end subroutine GRAF</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-06-10T17:16:11Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3756#p3756</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3755#p3755" />
			<content type="html"><![CDATA[<p>What does the function <em>noclosewin</em> look like?&nbsp; Can you post it?&nbsp; It should be something like:</p><div class="codebox"><pre><code>    function noclosewin ()
    implicit none
    integer::noclosewin 
    
        noclosewin = 0
        Print *, &quot;I blocked it&quot;
        
    end function noclosewin </code></pre></div><p>I tried the above on my system with the latest build, and it seemed to work.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-06-10T11:49:14Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3755#p3755</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3754#p3754" />
			<content type="html"><![CDATA[<p>Hi Jeff,<br />If I remove the parentheses as you mention I get the same error when trying to compile the source!<br />I enabled the visibility of warnings in the editor. And the editor already shows the mentioned error before I even can start the compiler.</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-06-09T17:27:15Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3754#p3754</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3753#p3753" />
			<content type="html"><![CDATA[<p>You need to pass the function itself, not call the function.&nbsp; You actually want to write:</p><div class="codebox"><pre><code>              call setwindowsystemclosecallback( noclosewin )</code></pre></div><p>By removing the parentheses, you&#039;re passing the function itself, not the result of calling the function, which is what your original code was doing.</p><p>Does that make sense?</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-06-08T18:40:45Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3753#p3753</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3752#p3752" />
			<content type="html"><![CDATA[<p>Hi Jeff,<br />First of all thanks for the new update version 3.19<br />I&#039;m trying to use the new &quot;setwindowsystemclosecallback&quot; routine<br />As described in the documentation, I created a callback-Function and after creating a window, I added the following line to my fortran source:&nbsp; &nbsp; &nbsp; &nbsp;call setwindowsystemclosecallback( noclosewin() )<br />Noclosewin() is the function I created and compiles without any errors!<br />When I then try to compile the main-source I get an error at the line with the call to the new subroutine as mentioned above:<br />&nbsp; &nbsp; Error: Expected a procedure for argument &#039;f&#039; at (1)</p><p>I defined noclosewin as &quot;integer&quot;<br />Am I doing something wrong?</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-06-08T14:28:49Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3752#p3752</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3744#p3744" />
			<content type="html"><![CDATA[<p>Hi Jeff,<br />Thanks for your reply. If you could add a API to block it I would be very happy.<br />I think it was in SF version 2 that it worked the way I described.<br />Again, thanks very much for your support!!</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-05-12T10:35:52Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3744#p3744</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3743#p3743" />
			<content type="html"><![CDATA[<p>John,</p><p>I see what you&#039;re asking now.&nbsp; You want to disable the Windows &quot;close&quot; button?&nbsp; If that ever did work in AppGraphics, it was a bug.&nbsp; The <em>closeflag</em> only means that the program won&#039;t terminate, not that the window won&#039;t close.&nbsp; If you click the close button, the window and its resources will be destroyed, but the program will keep running.</p><p>Overriding Windows&#039; <em>WM_CLOSE</em> is going to be messy.&nbsp; I would have to add a new API to block it.&nbsp; The better way to handle this would be to assign a callback using <em>setwindowclosecallback</em> that will trigger safe shutdown in the main thread.&nbsp; I&#039;ll see about cancelling the <em>WM_CLOSE</em> message, though.&nbsp; It will take a bit of time to add.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-05-11T19:05:35Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3743#p3743</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3742#p3742" />
			<content type="html"><![CDATA[<p>Jeff, I think I don&#039;t understand what you are saying.<br />In a previous version of SF, when I clicked the red window cross, nothing happened, and that is exactly what I want!<br />So, I don&#039;t want the window to be closed! Again, in a previous version it worked that way.<br />I have created an &quot;escape&quot;-button in my app, that the user must use, or click the &quot;escape&quot;-key to close the app and not the windows cross-button.<br /> So, I am wondering way this doesn&#039;t work any more.</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-05-11T15:06:55Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3742#p3742</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3741#p3741" />
			<content type="html"><![CDATA[<p>The issue in the example is that you&#039;re checking for keys pressed after the window is closed.&nbsp; The keyboard routines are tied to an AppGraphics window.&nbsp; The call to <em>kbhit</em> after the window closes causes an exception because a non-existent window keyboard queue is queried.</p><p>It probably shouldn&#039;t outright crash, though it might be hard to modify the library to avoid that.&nbsp; However, the fix would simply cause <em>kbhit</em> to return <em>.FALSE.</em>, leaving this example in an infinite loop.</p><p>Basically, if all the AppGraphics windows are closed, it is extremely dangerous to continue making calls to the library.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-05-11T12:51:21Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3741#p3741</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3740#p3740" />
			<content type="html"><![CDATA[<p>Hi Jeff,<br />As promised I send you a simple source. When running the executable the app creates a window and waits for a key to be pressed.<br />When the key is pressed the app will close without any issue.<br />When closing the app by hitting the red close-button of the window I get the mentioned error!</p><p>&nbsp; &nbsp; &nbsp; Program test<br />!<br />&nbsp; &nbsp; &nbsp; use appgraphics<br />!<br />&nbsp; &nbsp; &nbsp; implicit none<br />!<br />&nbsp; &nbsp; &nbsp; INTEGER ipixxx, ipixyy, maxpx, maxpy, winx, winy, iiwin, ic<br />&nbsp; &nbsp; &nbsp; INTEGER*2 port, imode, ipixelx, ipixely<br />&nbsp; &nbsp; &nbsp; CHARACTER*6 mnubuf<br />&nbsp; &nbsp; &nbsp; logical keypressed<br />!<br />&nbsp; &nbsp; &nbsp; maxpy = getmaxheight()<br />&nbsp; &nbsp; &nbsp; maxpx = getmaxwidth()<br />&nbsp; &nbsp; &nbsp; port = 38<br />&nbsp; &nbsp; &nbsp; imode = 180<br />&nbsp; &nbsp; &nbsp; if (maxpx .gt. 1500) then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ipixely = ((int2(maxpy)-int2(150)) / port) * port<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ipixelx = ((int2(maxpx)-int2(50)) / imode) * imode<br />&nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ipixely = ((int2(maxpy)-int2(30)) / port) * port<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ipixelx = ((int2(maxpx)-int2(5)) / imode) * imode<br />&nbsp; &nbsp; &nbsp; end if<br />!<br />&nbsp; &nbsp; &nbsp; winx = (maxpx - ipixelx) / 2<br />&nbsp; &nbsp; &nbsp; winy = (maxpy - ipixely) / 3<br />&nbsp; &nbsp; &nbsp; ipixxx = ipixelx<br />&nbsp; &nbsp; &nbsp; ipixyy = ipixely<br />!&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; mnubuf = &#039;Dynrel&#039;<br />&nbsp; &nbsp; &nbsp; iiwin = initwindow(ipixxx,ipixyy,mnubuf,winx,winy,dbflag=.false.,<br />&nbsp; &nbsp; &nbsp;+&nbsp; &nbsp; &nbsp; &nbsp; closeflag=.FALSE.)<br />!<br />450&nbsp; &nbsp;Keypressed = .FALSE.<br />&nbsp; &nbsp; &nbsp; Keypressed = kbhit()<br />&nbsp; &nbsp; &nbsp; IF (Keypressed) then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ic = getch()<br />&nbsp; &nbsp; &nbsp; end if<br />&nbsp; &nbsp; &nbsp; IF (Ic .LE. 0) GOTO 450<br />!<br />&nbsp; &nbsp; &nbsp; stop<br />!<br />&nbsp; &nbsp; &nbsp; END program test</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-05-10T17:59:01Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3740#p3740</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3739#p3739" />
			<content type="html"><![CDATA[<p>I will set up a source and send it to you!</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-05-10T17:44:25Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3739#p3739</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3738#p3738" />
			<content type="html"><![CDATA[<p>Sorry Jeff,<br />I stated that &quot;dbflag&quot; is not working but I mend &quot;closeflag&quot;</p>]]></content>
			<author>
				<name><![CDATA[john_p]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4020</uri>
			</author>
			<updated>2021-05-10T17:42:53Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3738#p3738</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Issue appgrafics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3734#p3734" />
			<content type="html"><![CDATA[<p>John,</p><p>I can&#039;t replicate this behavior.&nbsp; Do you have a simple code sample that causes this crash?</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-05-07T13:43:08Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3734#p3734</id>
		</entry>
</feed>
