<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — AppGraphics Basics]]></title>
		<link>http://forums.approximatrix.com/viewtopic.php?id=443</link>
		<atom:link href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=443&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in AppGraphics Basics.]]></description>
		<lastBuildDate>Sun, 08 Mar 2015 20:07:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1942#p1942</link>
			<description><![CDATA[<p>Indeed, using a module would be my preferred option too.</p><div class="quotebox"><cite>Bob wrote:</cite><blockquote><p>When I click it, fwin fails and Taskmanager shows three instances of graphics.exe *32 are created.</p></blockquote></div><p>This just reminded me of the other issue Bob had in <a href="http://forums.approximatrix.com/viewtopic.php?id=434">http://forums.approximatrix.com/viewtopic.php?id=434</a></p>]]></description>
			<author><![CDATA[null@example.com (davidb)]]></author>
			<pubDate>Sun, 08 Mar 2015 20:07:16 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1942#p1942</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1941#p1941</link>
			<description><![CDATA[<div class="quotebox"><cite>davidb wrote:</cite><blockquote><p>This is why I suggested using EXTERNAL or an interface block.</p><p>One rule that has always helped over the years is &quot;be as explicit as possible to help the compiler&quot;.</p><p>For the crash when running from the toolbar, wasn&#039;t there a similar issue reported recently? I looked but could not find it.</p></blockquote></div><p>David,</p><p>You&#039;re right.&nbsp; In this particular case, since <em>btnTest</em> isn&#039;t explicitly known to the compiler from within the <em>InitializeScreen</em> subroutine, an interface or EXTERNAL declaration would be necessary.&nbsp; I personally tend to use more Fortran-90-like scoping in all cases, throwing all subroutines and functions into modules to avoid issues like what Bob reported and avoid having to write interface blocks.</p><p>The crashing bug is a new one.&nbsp; There was a similar issue recently where projects with spaces in their paths that aren&#039;t on the boot drive would not start.&nbsp; However, that bug didn&#039;t cause a crash and has since been fixed.&nbsp; I&#039;m not sure exactly what Bob&#039;s seeing.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Sun, 08 Mar 2015 17:58:35 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1941#p1941</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1940#p1940</link>
			<description><![CDATA[<div class="quotebox"><cite>jeff wrote:</cite><blockquote><p>When you have the line <em>call btnTest</em> first, it is apparently alerting the compiler that <em>btnTest</em> is a subroutine.&nbsp; When you use it only in the <em>createbutton</em> call, there is nothing to indicate it is a subroutine.&nbsp; Because you haven&#039;t declared <em>implicit none</em>, the compiler (correctly) assumes that btnTest is a real (floating point) value.</p></blockquote></div><p>This is normal for Fortran. It assumes that a sub-program argument is a function call unless you tell it otherwise (It has to do this because of the requirement to allow &quot;independent compilation&quot; in F77). As you note, in this case no error is reported because Implicit typing is being used. Potentially, an error could have been reported at link time but gfortran&#039;s linker is not that clever.</p><p>This is why I suggested using EXTERNAL or an interface block.</p><p>One rule that has always helped over the years is &quot;be as explicit as possible to help the compiler&quot;.</p><p>For the crash when running from the toolbar, wasn&#039;t there a similar issue reported recently? I looked but could not find it.</p>]]></description>
			<author><![CDATA[null@example.com (davidb)]]></author>
			<pubDate>Sun, 08 Mar 2015 15:08:30 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1940#p1940</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1939#p1939</link>
			<description><![CDATA[<p>Also, I&#039;ll look into why you&#039;re seeing a crash on program launch from the toolbar.&nbsp; That&#039;s a pretty severe bug.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Sun, 08 Mar 2015 13:45:26 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1939#p1939</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1938#p1938</link>
			<description><![CDATA[<p>Bob,</p><p>You&#039;re having some minor scope issues associated with Fortran 90 and higher.&nbsp; When you have the line <em>call btnTest</em> first, it is apparently alerting the compiler that <em>btnTest</em> is a subroutine.&nbsp; When you use it only in the <em>createbutton</em> call, there is nothing to indicate it is a subroutine.&nbsp; Because you haven&#039;t declared <em>implicit none</em>, the compiler (correctly) assumes that btnTest is a real (floating point) value.</p><p>If I add <em>implicit none</em> to the subroutine <em>InitializeScreen</em>, I actually end up with two errors because <em>myscreen</em> is also undeclared.&nbsp; I would suggest, for this example, changing the code to:</p><div class="codebox"><pre><code>program main               !    Loading from F:\ a Jump Drive       
use appgraphics
!   see  http://simplyfortran.com/docs/appgraphics/controls.html
implicit none

character * 30 :: msg; msg = &quot; Executing From F: Test 94&quot;                               

    call InitializeScreen()
    call loop()
    call closewindow()

contains

    !--------------------------------------------------------
    Subroutine InitializeScreen()  ! ============ InitializeScreen()
    use appgraphics
    implicit none
    
        character * 30 :: msg2
        integer :: start_button
        integer::myscreen
    
        msg2 = &quot;In InitializeScreen()    &quot;
        myscreen = initwindow(400, 200, title=&quot;Controls Demo&quot;, closeflag=.TRUE.)
        !    call setbkcolor(systemcolor(COLOR_WINDOW_BKGD))
        call setbkcolor(LIGHTGRAY)
        call clearviewport()  ! to display the windows background color

        start_button = createbutton(100, 100,120,50,&quot;Button Test&quot;, btnTest)
        call enablebutton(start_button, .TRUE.)
    End Subroutine InitializeScreen
    
    ! ==================================================
    Subroutine btnTest
    use appgraphics
    implicit none

        character * 30 :: msg4
        msg4 = &quot;BtnTest was reached Attempt 4&quot;

        call dlgmessage(DIALOG_INFO,msg4)
    End Subroutine btnTest

end program main  ! ===================== End main </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Sun, 08 Mar 2015 13:44:54 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1938#p1938</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1937#p1937</link>
			<description><![CDATA[<p>Answers: 1. No&nbsp; &nbsp; 2. Yes&nbsp; 3. No&nbsp; I save build launch&nbsp; manually 4. No</p><p>I think&nbsp; &nbsp;fWin (not Responding) may have an issue with the long directory path like <br />J:\Fortran\Bobs Examples\Simply Fortran\AppGraphics01<br />When the project is placed on f:\&nbsp; a jump drive ..it works as expected.<br />Since running from F:\&nbsp; ( a jump drive ) works just fine,&nbsp; I&#039;m not that concerned.</p><p>Next issue .......&nbsp; removing call btnTest line . </p><p>program main&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;!&nbsp; &nbsp; Loading from F:\ a Jump Drive&nbsp; &nbsp; &nbsp; &nbsp;<br />use appgraphics<br />!&nbsp; &nbsp;see&nbsp; <a href="http://simplyfortran.com/docs/appgraphics/controls.html">http://simplyfortran.com/docs/appgraphics/controls.html</a><br />implicit none<br />integer::myscreen<br />character * 30 :: msg; msg = &quot; Executing From F: Test 94&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </p><p>call InitializeScreen() <br />call loop()<br />call closewindow(myscreen)<br />end program main&nbsp; ! ===================== End main&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />!--------------------------------------------------------<br />Subroutine InitializeScreen()&nbsp; ! ============ InitializeScreen()<br />use appgraphics<br />character * 30 :: msg2 <br />integer :: start_button<br />msg2 = &quot;In InitializeScreen()&nbsp; &nbsp; &quot;<br />myscreen = initwindow(400, 200, title=&quot;Controls Demo&quot;, closeflag=.TRUE.)<br />!&nbsp; &nbsp; call setbkcolor(systemcolor(COLOR_WINDOW_BKGD))<br />call setbkcolor(LIGHTGRAY)<br />call clearviewport()&nbsp; ! to display the windows background color<br />call btnTest ! I should be able to remove this line&nbsp; but when I<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;! Comment out the call btnTest line, the build fails since the <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;! start_button line gets a red underscore<br />start_button = createbutton(100, 100,120,50,&quot;Button Test&quot;, btnTest)<br />call enablebutton(start_button, .TRUE.)<br />End Subroutine InitializeScreen<br />! ==================================================<br />Subroutine btnTest<br />&nbsp; &nbsp; use appgraphics<br />&nbsp; &nbsp; character * 30 :: msg4<br />&nbsp; &nbsp; msg4 = &quot;BtnTest was reached Attempt 4&quot;<br />&nbsp; &nbsp; call dlgmessage(DIALOG_INFO,msg4)<br />End Subroutine btnTest<br />-----------------------------------------------------------------------------</p><p>Any help is appreciated.<br />&nbsp; Bob</p>]]></description>
			<author><![CDATA[null@example.com (Bob)]]></author>
			<pubDate>Sun, 08 Mar 2015 01:32:40 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1937#p1937</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1936#p1936</link>
			<description><![CDATA[<p>Bob,</p><p>Are you saying that Simply Fortran crashes when you click the green arrow on the toolbar?&nbsp; That is a significant bug if so.&nbsp; In what directory have you saved your Fortran source code, out of curiousity?</p><p>EDIT: I also wanted to ask:</p><p>1.&nbsp; Does the Console tab open prior to crashing?<br />2.&nbsp; Does your project have &quot;Windows GUI&quot; checked in the Project Options window?<br />3.&nbsp; Do you currently have <a href="http://simplyfortran.com/docs/full/options/launch.html">Build Before Launch</a> enabled?<br />4.&nbsp; Does every Simply Fortran project you have fail to launch when you click the toolbar button?</p><p>Sorry for all the trouble!</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Fri, 06 Mar 2015 21:40:20 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1936#p1936</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1935#p1935</link>
			<description><![CDATA[<p>Thanks and the button now works......however -<br />I still cannot run by clicking the green arrow.<br />When I click it, fwin fails and Taskmanager shows three instances of graphics.exe *32 are created.<br />On the other hand, if after a build&nbsp; I dbl click the icon in Windows explorer, all works well.<br />If you can share any ideas, let me know.<br />BR<br />&nbsp; Bob</p>]]></description>
			<author><![CDATA[null@example.com (Bob)]]></author>
			<pubDate>Fri, 06 Mar 2015 19:43:17 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1935#p1935</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1934#p1934</link>
			<description><![CDATA[<p>Bob,</p><p>Your program actually compiles and runs fine.&nbsp; The only issue is your button placement.&nbsp; Looking at your <em>InitializeScreen</em> routine:</p><div class="codebox"><pre><code>Subroutine InitializeScreen()  ! ============ InitializeScreen()
use appgraphics
character * 30 :: msg2
integer :: start_button
msg2 = &quot;In InitializeScreen()    &quot;
myscreen = initwindow(400, 200, title=&quot;Controls Demo&quot;, closeflag=.TRUE.)
! call setbkcolor(systemcolor(COLOR_WINDOW_BKGD))
call setbkcolor(WHITE)
call clearviewport()  ! to display the windows background color
call dlgmessage(DIALOG_INFO,msg2)

call btnTest  ! and it executes as expected  but
! Comment out the above line and the build fails

start_button = createbutton(100, 200,120,50,&quot;Button Test&quot;, btnTest)
call enablebutton(start_button, .TRUE.)

End Subroutine InitializeScreen</code></pre></div><p>you&#039;ll note that the y-coordinate of your button is 200, but your window is also only 200 pixels tall.&nbsp; If I move your button to a y-coordinate of 150:</p><div class="codebox"><pre><code>start_button = createbutton(100, 150,120,50,&quot;Button Test&quot;, btnTest)</code></pre></div><p>it now appears in the window and behaves as one would expect.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Fri, 06 Mar 2015 13:37:18 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1934#p1934</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1933#p1933</link>
			<description><![CDATA[<p>Below is the minimum code I would think ought to display a button and when clicked a message should be displayed.<br />Will it work for you ?<br />!================================================</p><p>program main&nbsp; &nbsp; &nbsp; &nbsp; <br />use appgraphics<br />!&nbsp; &nbsp;see&nbsp; <a href="http://simplyfortran.com/docs/appgraphics/controls.html">http://simplyfortran.com/docs/appgraphics/controls.html</a><br />implicit none<br />integer::myscreen<br />character * 30 :: msg<br />!----------------------------------------------------<br />msg = &quot; Executing Test 94&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />call dlgmessage(DIALOG_INFO,msg)<br />call InitializeScreen() <br />! call btnTest <br />call loop()<br />call closewindow(myscreen)<br />end program main&nbsp; ! =========================== End main<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />!--------------------------------------------------------<br />Subroutine InitializeScreen()&nbsp; ! ============ InitializeScreen()<br />use appgraphics<br />character * 30 :: msg2<br />integer :: start_button<br />msg2 = &quot;In InitializeScreen()&nbsp; &nbsp; &quot;<br />myscreen = initwindow(400, 200, title=&quot;Controls Demo&quot;, closeflag=.TRUE.)<br />! call setbkcolor(systemcolor(COLOR_WINDOW_BKGD))<br />call setbkcolor(WHITE)<br />call clearviewport()&nbsp; ! to display the windows background color<br />call dlgmessage(DIALOG_INFO,msg2)</p><p>call btnTest&nbsp; ! and it executes as expected&nbsp; but<br />! Comment out the above line and the build fails </p><p>start_button = createbutton(100, 200,120,50,&quot;Button Test&quot;, btnTest)<br />call enablebutton(start_button, .TRUE.)</p><p>End Subroutine InitializeScreen<br />! ==================================================<br />Subroutine btnTest<br />&nbsp; &nbsp; use appgraphics<br />&nbsp; &nbsp; character * 30 :: msg4<br />&nbsp; &nbsp; msg4 = &quot;BtnTest was reached&quot;<br />&nbsp; &nbsp; call dlgmessage(DIALOG_INFO,msg4)<br />End Subroutine btnTest</p><p>! ---------------------------------------BR&nbsp; Bob</p>]]></description>
			<author><![CDATA[null@example.com (Bob)]]></author>
			<pubDate>Fri, 06 Mar 2015 00:15:00 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1933#p1933</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1931#p1931</link>
			<description><![CDATA[<div class="quotebox"><cite>davidb wrote:</cite><blockquote><p>If you are trying to pass a reference to the btnTest subroutine (so createbutton can call it) then you also need to declare it as EXTERNAL or provide an interface definition for it.</p></blockquote></div><p>David,</p><p>Using the <em>EXTERNAL</em> or providing an interface block is unnecessary as long as the subroutine being referenced in the <em>createbutton</em> call is within scope.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 05 Mar 2015 16:46:01 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1931#p1931</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1930#p1930</link>
			<description><![CDATA[<p>Bob,</p><p>You&#039;re close to correct on the <em>createbutton</em> call.&nbsp; What you need to have is:</p><div class="codebox"><pre><code>integer :: start_button
start_button = createbutton(100, 200,120,50,&quot;Button Test&quot;, btnTest)</code></pre></div><p>You are passing the subroutine itself, not a call to it.&nbsp; If you include parentheses, you are implying that btnTest is either a function call or an array (if there had been anything in the parentheses).&nbsp; The <em>createbutton</em> functions expects merely the name of an appropriate subroutine.</p><p>In the &quot;Conway&#039;s Game of Life&quot; example that ships with Simply Fortran, have a look at the file <strong>screen.f90</strong> and, specifically, the <em>init_screen</em> subroutine where two buttons are created.&nbsp; The subroutines they reference are, incidentally, located off in another module in the <strong>control.f90</strong> file.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 05 Mar 2015 16:44:11 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1930#p1930</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1929#p1929</link>
			<description><![CDATA[<p>You have declared btnTest to be a subroutine but in the call to createbutton you are using syntax which assumes it is a function.</p><p>Perhaps you should remove the parenthesis () from the btnTest argument. </p><p>If you are trying to pass a reference to the btnTest subroutine (so createbutton can call it) then you also need to declare it as EXTERNAL or provide an interface definition for it.</p><p>I have not looked at the syntax for createbutton so I cannot be sure this would solve all your problems.</p>]]></description>
			<author><![CDATA[null@example.com (davidb)]]></author>
			<pubDate>Thu, 05 Mar 2015 08:38:01 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1929#p1929</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1928#p1928</link>
			<description><![CDATA[<p>Actually the form was constructed in Visual Studio&nbsp; for comment purposes only<br />The actual code contains a createbutton which fails. <br />Below is relevant code</p><p>integer :: start_button<br />start_button = createbutton(100, 200,120,50,&quot;Button Test&quot;, btnTest())<br />!&nbsp; The above is incorrect&nbsp; but why&nbsp; </p><p>Subroutine btnTest<br />! some code is here and works <br />End Subroutine btnTest</p><p>I can call btnTest from another place in the code successfully.</p><p>Any ideas ?</p><p>Bob</p>]]></description>
			<author><![CDATA[null@example.com (Bob)]]></author>
			<pubDate>Wed, 04 Mar 2015 23:30:59 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1928#p1928</guid>
		</item>
		<item>
			<title><![CDATA[Re: AppGraphics Basics]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1925#p1925</link>
			<description><![CDATA[<p>Bob,</p><p>So you&#039;ve coded that window up in AppGraphics?&nbsp; It looks quite good!&nbsp; If you need any assistance or have any question, please don&#039;t hesitate to post here.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Mon, 02 Mar 2015 12:58:13 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1925#p1925</guid>
		</item>
	</channel>
</rss>
