<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — Why no response to mouse wheel?]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=886</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=886&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Why no response to mouse wheel?.]]></description>
		<lastBuildDate>Thu, 16 Feb 2023 01:57:26 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4070#p4070</link>
			<description><![CDATA[<p>Thanks Jeff.&nbsp; Appreciate all the work.</p>]]></description>
			<author><![CDATA[null@example.com (jackmitchener)]]></author>
			<pubDate>Thu, 16 Feb 2023 01:57:26 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4070#p4070</guid>
		</item>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4069#p4069</link>
			<description><![CDATA[<p>Sorry, I meant that you should connect a different subroutine to the mouse wheel events, like this:</p><div class="codebox"><pre><code>program main
use appgraphics
implicit none
    integer::screen
    integer::x, y, r, i
    logical::pt=.FALSE.,whL=.FALSE.
    common whL, r
    
    interface
        subroutine mouseclick(mx, my)
        integer::mx, my
        end subroutine mouseclick
    end interface
    
    interface
        subroutine mousewheel(wx, wignored)
        integer::wx, wignored
        end subroutine mousewheel
    end interface
    
    x=10
    y=10
    r=20   
    screen = initwindow(800, 600)
    call registermousehandler(MOUSE_LB_DOWN,mouseclick)
    call registermousehandler(MOUSE_WHEEL,mousewheel)   
    call settextstyle(1,0,20)   
    do while(x &lt;= 800)
      call clearviewport
      IF (whL) THEN
        y=y-40
      ENDIF
      call circle(x,y,r)     
      call outtextxy(x,y,char(r),pt)
      i=0
      do while(i &lt; 20000000)
         i=i+1
      end do
      x=x+5
      y=y+5
      r=r+1
    end do
    call delay(1)
    call closewindow(screen)
end program main

subroutine mouseclick(mx, my)
use appgraphics
    implicit none
    integer mx, my, r
    logical whL
    common whL, r
    if (ismouseclick(MOUSE_LB_DOWN)) then
        call circle(mx,my,2*r)
        call clearmouseclick(MOUSE_LB_DOWN)
        ! call clearmouseclick(MOUSE_WHEEL)
    endif       
end subroutine mouseclick

subroutine mousewheel(wx, wignored)
use appgraphics
    implicit none
    integer wx, wignored, r
    logical whL
    common whL, r
        whL = .TRUE.
end subroutine mousewheel</code></pre></div><p>Note that the calls to <em>registermousehandler</em> use two different subroutines.&nbsp; Also, the click handler is passed in the coordinates at the time of the click.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Tue, 14 Feb 2023 16:33:56 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4069#p4069</guid>
		</item>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4068#p4068</link>
			<description><![CDATA[<p>Perhaps a new function?&nbsp; &quot;Getmousewheel()&quot;&nbsp; &nbsp;It could return an integer: -1 = backward motion, 0 = no motion, +1 = forward motion.</p>]]></description>
			<author><![CDATA[null@example.com (jackmitchener)]]></author>
			<pubDate>Tue, 14 Feb 2023 15:22:14 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4068#p4068</guid>
		</item>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4067#p4067</link>
			<description><![CDATA[<p>Still do not see how I can know if the mouse wheel has been turned.&nbsp; And, if turned, in which direction. Are you saying that I should have used&nbsp; Getmouseclick(kind, x,y) ?</p>]]></description>
			<author><![CDATA[null@example.com (jackmitchener)]]></author>
			<pubDate>Tue, 14 Feb 2023 15:09:14 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4067#p4067</guid>
		</item>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4066#p4066</link>
			<description><![CDATA[<p>Umm . . . &quot;the call to the callback procedure&quot; ??</p>]]></description>
			<author><![CDATA[null@example.com (jackmitchener)]]></author>
			<pubDate>Tue, 14 Feb 2023 14:55:22 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4066#p4066</guid>
		</item>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4065#p4065</link>
			<description><![CDATA[<p>Looking through the underlying code a bit more, the <strong>MOUSE_WHEEL</strong> events are not queued, in contrast to clicks, which are queued.&nbsp; The call to the callback procedure is the only way to handle wheel events.&nbsp; Clicks, on the other hand, could be handled elsewhere.&nbsp; The <em>ismouseclick</em> and <em>getmouseclick</em> subroutines rely on calls to the queues, which wouldn&#039;t apply in this case.</p><p>The API isn&#039;t ideal, but it should have been documented better.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Mon, 13 Feb 2023 13:33:53 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4065#p4065</guid>
		</item>
		<item>
			<title><![CDATA[Re: Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4064#p4064</link>
			<description><![CDATA[<p>The documentation for whatever reason doesn&#039;t explain this behaivor, but <em>ismouseclick</em> always returns <strong>.false.</strong> for <strong>MOUSE_WHEEL</strong> events.&nbsp; I think the reasoning on this decision is that a wheel event certainly isn&#039;t a &quot;click.&quot;&nbsp; I would suggest using a separate subroutine to catch the mouse wheel events.</p><p>By the way, the subroutine <em>mcirc</em> should accept two integer arguments that specify the mouse position or, in the case of a mouse wheel even, the change in x and zero.</p><p>I&#039;ll make sure the documentation is updated and maybe look through the mouse handling code to see that everything is consistent.&nbsp; Thank you for pointing this out.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Mon, 13 Feb 2023 12:27:22 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4064#p4064</guid>
		</item>
		<item>
			<title><![CDATA[Why no response to mouse wheel?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=4062#p4062</link>
			<description><![CDATA[<p>Trying to interact with the mouse on graphics primitives.&nbsp; Program below recognizes Mouse-LB-down. But it cannot sense movement of the mouse wheel. Why?</p><p>program main<br />use appgraphics<br />implicit none<br />&nbsp; &nbsp; integer::screen<br />&nbsp; &nbsp; integer::x, y, r, i <br />&nbsp; &nbsp; logical::pt=.FALSE.,whL=.FALSE.<br />&nbsp; &nbsp; common whL, r<br />&nbsp; &nbsp; x=10<br />&nbsp; &nbsp; y=10<br />&nbsp; &nbsp; r=20&nbsp; &nbsp; <br />&nbsp; &nbsp; screen = initwindow(800, 600)<br />&nbsp; &nbsp; call registermousehandler(MOUSE_LB_DOWN,mcirc)<br />&nbsp; &nbsp; call registermousehandler(MOUSE_WHEEL,mcirc)&nbsp; &nbsp; <br />&nbsp; &nbsp; call settextstyle(1,0,20)&nbsp; &nbsp; <br />&nbsp; &nbsp; do while(x &lt;= 800)<br />&nbsp; &nbsp; &nbsp; call clearviewport<br />&nbsp; &nbsp; &nbsp; call mcirc<br />&nbsp; &nbsp; &nbsp; IF (whL) THEN<br />&nbsp; &nbsp; &nbsp; &nbsp; y=y-40<br />&nbsp; &nbsp; &nbsp; ENDIF<br />&nbsp; &nbsp; &nbsp; call circle(x,y,r)&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; call outtextxy(x,y,char(r),pt) <br />&nbsp; &nbsp; &nbsp; i=0<br />&nbsp; &nbsp; &nbsp; do while(i &lt; 20000000)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i=i+1<br />&nbsp; &nbsp; &nbsp; end do <br />&nbsp; &nbsp; &nbsp; x=x+5<br />&nbsp; &nbsp; &nbsp; y=y+5<br />&nbsp; &nbsp; &nbsp; r=r+1<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp; call delay(1)<br />&nbsp; &nbsp; call closewindow(screen)<br />end program main</p><p>subroutine mcirc<br />use appgraphics<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; integer mx, my, r<br />&nbsp; &nbsp; logical whL<br />&nbsp; &nbsp; common whL, r<br />&nbsp; &nbsp; if (ismouseclick(MOUSE_WHEEL)) THEN<br />&nbsp; &nbsp; &nbsp; &nbsp; whL = .TRUE.<br />&nbsp; &nbsp; endif<br />&nbsp; &nbsp; if (ismouseclick(MOUSE_LB_DOWN)) then<br />&nbsp; &nbsp; &nbsp; &nbsp; mx = mousex()<br />&nbsp; &nbsp; &nbsp; &nbsp; my = mousey()<br />&nbsp; &nbsp; &nbsp; &nbsp; call circle(mx,my,2*r)<br />&nbsp; &nbsp; &nbsp; &nbsp; call clearmouseclick(MOUSE_LB_DOWN)<br />&nbsp; &nbsp; &nbsp; &nbsp; ! call clearmouseclick(MOUSE_WHEEL)<br />&nbsp; &nbsp; endif&nbsp; &nbsp; &nbsp; &nbsp;<br />end subroutine mcirc</p>]]></description>
			<author><![CDATA[null@example.com (jackmitchener)]]></author>
			<pubDate>Sat, 11 Feb 2023 19:52:59 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=4062#p4062</guid>
		</item>
	</channel>
</rss>
