|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
ursuselasticus
Joined: 26 Mar 2005 Posts: 71
|
Posted: Sun May 29, 2005 6:41 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Hi there,
running my programs I encounter a few problems, where clearwin behaves differently from what I expect it to do. I would appreciate any support to get a starting point where to start my bugsearch.
I am running clearwin in a MS XP-home edition environment, SP 1 included (not SP2).
Here is the first one, concerning the mouse. I boiled down a far bigger routine to that few lines of code still showing my problem:
(1) include <windows.ins>
(2) ictrl=0
(3) iwin=winio@('%gr[grey]&',400,200)
(4) iwin=winio@('%lw',ictrl)
(5)10 call get_mouse_info@(ix,iy,iflag)
(6) print*,ix,iy,iflag
(7) if(iflag.eq.0) then
( call sleep@(0.5)
(9) goto 10
(10) endif
(11) stop
(12) end
The idea is, I want to get info on the cursor position at any time the cursor is inside of the graphic window.
From what I get from the docs about get_mouse_info I would expect to receive ix and iy any time get_mouse_position is called, each .2 seconds here. After some time with the mouse in the graphic window I should expect a number of printouts in the textwindow, giving cursor positions.
Without line# 4, I only get a printout after I clicked lmb, otherwise the whole program seems to be on hold.
With line #4 (and the appropriate & in line #3) I get a series of prints, but all being 0, unless lmb is pressed.
Oh by the way, I am one of the fossils relying on implicit data types, that's why ix, iy, iflag are integers.
Any ideas ??
Norbert |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Mon May 30, 2005 3:16 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Nobert
If it is any comfort, I had many (and have) with the 'mouse control'. Try to declare the ix, etc as integer*4 (not that I think that is the problem). Then rather than print the ix, etc use something along the line i=winio@('x: %wd',ix). Also is chck the iflag and then go to ........ when iflag.eq........
If your program hangs, then get out of Plato altogether and start again.
Hope this may help.
Sten
sten.lou@conocophillips.com |
|
Back to top |
|
|
ursuselasticus
Joined: 26 Mar 2005 Posts: 71
|
Posted: Mon May 30, 2005 10:40 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Thanks Sten,
it sure is of some comfort to know not to be the only one to have such problems. You know, you would start thinking what makes you different from the rest of the users, them being happy using this stuff and only stupid me ...
Well, I will work through your hints one after the other and will give some feedbeack on what did succeed (that's optimism, isn't it ?).
Norbert |
|
Back to top |
|
|
Martin
Joined: 09 Sep 2004 Posts: 43
|
Posted: Wed Jun 01, 2005 9:38 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Norbert,
The documentation for get_mouse_info@ (in the FTN95 manual) states that it should only be used inside a %gr callback routine. However, contrary to this, it seems you can actually use the routine wherever you like as long as you specify the full_mouse_input option for the %gr.
Martin
|
|
Back to top |
|
|
ursuselasticus
Joined: 26 Mar 2005 Posts: 71
|
Posted: Sat Jun 04, 2005 7:57 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Martin,
thank you, this one did it. I get all the mouse info I want any time get_mouse_info is called, when full_mouse_input is specified as option for the grahics window.
Norbert |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Jun 08, 2005 2:39 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Here is some sample code that may help.....
winapp
c---------------------------------------------------------------
include <windows.ins>
integer mstat
character*30 cstat
common/control/ mstat,cstat
integer i,gr_func
external gr_func
cstat=' '
mstat=0
i=winio@('%ww[no_border]&')
i=winio@('%ca[Box Selection]&')
i=winio@('%mn[E&xit]&','EXIT')
i=winio@('%ob&')
i=winio@('%^gr[black,box_selection,full_mouse_input]&',
+ 300,300,gr_func)
c See also set_graphics_selection@
i=winio@('%cb&')
i=winio@('%ob[status]%20st%cb',cstat)
end
c-----------------------------------------------------------
integer function gr_func()
include <windows.ins>
integer mstat
character*30 cstat
common/control/ mstat,cstat
integer x1,y1,x2,y2,nstat,a,b
call get_mouse_info@(x1,y1,nstat)
write(cstat(1:30),'(3I7)') x1,y1,nstat
call window_update@(cstat)
if(and(nstat,MK_LBUTTON).eq.0.and.and(mstat,MK_LBUTTON).ne.0)then
call get_graphics_selected_area@(x1,y1,x2,y2)
if(and(nstat,MK_SHIFT).eq.MK_SHIFT) then
call rectangle@(x1,y1,x2,y2,12)
elseif(and(nstat,MK_CONTROL).eq.MK_CONTROL) then
a=0.5*(x2-x1)
b=0.5*(y2-y1)
call ellipse@(x1+a,y1+b,a,b,12)
else
call draw_line@(x1,y1,x2,y2,12)
endif
endif
mstat=nstat
gr_func=2
end
c-----------------------------------------------------------
|
|
Back to top |
|
|
ursuselasticus
Joined: 26 Mar 2005 Posts: 71
|
Posted: Sat Jun 11, 2005 8:23 am Post subject: Various Problems with Clearwin - (1) getting mouse data |
|
|
Thanks Paul,
I did test your code and it works fine. I will try to adapt my coding to this example and see how far I can get with this. Maybe all the other problems I have encountered - and was about to post here - will be solved along with this one here.
Thanks again.
Norbert |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|