|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Fri Dec 09, 2022 2:57 pm Post subject: DISPLAY_DIB_BLOCK@ and mouse |
|
|
I have a simple program that reads and displays an image file using DISPLAY_DIB_BLOCK@. It works just fine.
I now want to use the mouse to get a few pixel positions in the image, but seem to be caught in a catch-22. If I call clearwin_info@ to get the mouse flags and the x and y coordinates before the widow is closed, I don't see the image or the mouse cursor. If I close the image window first, then I can't get the mouse position and the program hangs.
Code: |
...
kontrol = 0
i=winio@('%gr%lw&',nx1,ny1,kontrol)
CALL display_dib_block@(0,0,dib,nx1,ny1,0,0,nx1,ny1,0,0,ierr)
i=winio@('%nl%^bt[CLOSE]','EXIT')
iflags=0
10 iflags = clearwin_info@ ('GRAPHICS_MOUSE_FLAGS')
if (iflags.ne.1) goto 10
mousex = clearwin_info@ ('GRAPHICS_MOUSE_X')
mousey = clearwin_info@ ('GRAPHICS_MOUSE_Y')
...
|
nx1, ny1 are the image dimensions that I got from a previous call to get_dib_size@ and the image file itself was imported using get_dib_block@
What am I doing wrong? _________________ (Steve Henley) |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8017 Location: Salford, UK
|
Posted: Fri Dec 09, 2022 4:14 pm Post subject: |
|
|
Normally you would call clearwin_info@ from a callback function, in this case it would be attached to %gr using %^gr
integer,external::cbfunc
i=winio@('%^gr%lw&',nx1,ny1,cbfunc,kontrol) |
|
Back to top |
|
|
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Fri Dec 09, 2022 4:46 pm Post subject: |
|
|
Many thanks, Paul. Yes, something stirs in my memory. I did this once before. This is the problem when coding only intermittently over a period of many years! I shall give that a try. _________________ (Steve Henley) |
|
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
|