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 

Coordinates of mouse click in %gr[full_mouse_input] + %pm

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



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Mon Nov 04, 2019 2:19 am    Post subject: Coordinates of mouse click in %gr[full_mouse_input] + %pm Reply with quote

I have been experimenting with the option [popup] applied to %gr which allows a %pm menu to appear with %gr[full_mouse_input].

Clearwin_info@('POPUP_X') and clearwin_info@('POPUP_Y') return the coordinates of the right mouse click in the %gr region which initiated the popup menu. These values are screen coordinates and not the position in the %gr region.

Is there an equivalent clearwin_info@ parameter which returns the coordinates of the right mouse click in the graphics region? Or how do I find the position of the origin of the %gr region in screen coordinates?

Thanks

Ken
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: Mon Nov 04, 2019 11:04 am    Post subject: Reply with quote

Try calling GET_WINDOW_LOCATION@ using the hwnd corresponding to %lc and %gr.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Nov 04, 2019 11:08 am    Post subject: Reply with quote

What about GRAPHICS_MOUSE_X and _Y ?

Eddie
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Mon Nov 04, 2019 1:19 pm    Post subject: Reply with quote

Thanks Paul,

That put me on the right track. It was a long day yesterday!

A call to GET_WINDOW_LOCATION@ gives me the screen coordinates of the window (via %hw), say x(0), y(0).

Another call to GET_WINDOW_LOCATION@ gives me the coordinates of the graphics region relative to the window (via %lc), i.e. x(1) and x(1).

Then a call to CLEARWIN_INFO@ ‘POPUP_X’ and ‘POPUP_Y’ gives me the coordinates of the right mouse click relative to the screen; x(2) and y(2).

The coordinates of at which popup click occurred in the graphics region coordinates in local coordinates are then:
X = x(2) – x(0) – x(1)
Y = y(2) – y(0) – y(1)

Eddie,

I could not get GRAPHICS_MOUSE_X and _Y, to work very well – due to the full_mouse_input and the possibility of the user moving the mouse across the sub-menus in the popup or outside the popup. I also had a %^gr call back in there at one point along side the %pm – all very confusing,

Ken
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Nov 04, 2019 2:18 pm    Post subject: Reply with quote

Probably the full_mouse_input catches you out, agreed. My biggest app works without proper Clearwin+ popups as they didn't work when I was developing it, and I had to make my own using volatile and drop_shadow windows. The big advantage, I found later, with a do-it-yourself approach is that the pop ups can contain data input boxes, e.g. if the first pop up contains 'edit coordinates', that can launch another that has boxes in which to edit them.

You probably had to go to full-mouse_input because with the quick and dirty method the left click has to be assigned to something unimportant because you get one before and after a double-click.


So GRAPHICS_MOUSE_X etc works for me.

Eddie
Back to top
View user's profile Send private message
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