forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DISPLAY_DIB_BLOCK@ and mouse

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Fri Dec 09, 2022 2:57 pm    Post subject: DISPLAY_DIB_BLOCK@ and mouse Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Dec 09, 2022 4:14 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Fri Dec 09, 2022 4:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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