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 

Right mouse menu over %gr

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



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Feb 02, 2010 2:58 am    Post subject: Right mouse menu over %gr Reply with quote

How make it to appear exactly over the graphics %gr area where mouse is? All works OK like is supposed to if %gr is not "full_mouse_input".

Otherwise %pm menu appears only on the border of the window (outside the plotted graphics or displayed bitmap)


Last edited by DanRRight on Tue Feb 02, 2010 4:07 am; edited 2 times in total
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Tue Feb 02, 2010 3:28 am    Post subject: Reply with quote

Dan,

I don't use %pm, but I monitor for a right mouse click and then call a routine with the following winio@ calls.
Code:
!
      i = winio@ ('%ca[Node Information]&')
      i = winio@ (' Node Number %6wd&', node)
      i = winio@ ('      [%6wd]&', nf)
      i = winio@ ('%nl%6wd %6wd %6wd %6wd %6wd %6wd&',   &
                   rxyz(1),rxyz(2),rxyz(3),rxyz(4),rxyz(5),rxyz(6) )
      i = winio@ ('%2nlX  = %12wf&',pnxyz(1))
      i = winio@ ( '%nlY  = %12wf&',pnxyz(2))
      i = winio@ ( '%nlZ  = %12wf&',pnxyz(3))
      i = winio@ ('%2nlLoad Number %6wd&', load_case)
      i = winio@ ( '%nlDx = %12wf&',pdxyz(1))
      i = winio@ ( '%nlDy = %12wf&',pdxyz(2))
      i = winio@ ( '%nlDz = %12wf&',pdxyz(3))
      i = winio@ ('%2nl%cn%bt[OK]')
!

It may not be the most elegent solution, but it pops up in the centre of the screen. I have no control of the location of this "pop-up"

I'd like to be educated on how %pm can provide a better solution.

John
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Feb 02, 2010 4:13 am    Post subject: Reply with quote

Yes, thanks, John, if %pm can not be fixed to work like it is supposed to with full mouse input, i will make it like you are doing

Changing your window position is easy. One can use couple of appropriate functions, do not remember exactly, they are %ap, %rp or %sp or something like that, forgot which one is needed.

I find %pm is useful. Almost every other software uses it. In my practice there were cases though when it was annoying and even not acceptable. You can look at my example with MESH or PIE - this is exactly this case (if i did not remove it from there already, it was used for loads-savings, exits or something like that) - right click is better to use for other useful functions to handle complex moves of objects. Saving simple 2D graphics not requiring all 3 buttons and scrolling wheel with %pm is convenient. Sometimes the way you show above is more logical and convenient too.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Feb 02, 2010 8:40 am    Post subject: Reply with quote

If %pm is not working correctly in the context of %gr then I should be able to reproduce this but, as always, it is far better for me if you could post some code that illustrates the failure. There are changes going on at my end that may influence the problem so I might spend a long time trying to work out if it has already been fixed.
Back to top
View user's profile Send private message AIM Address
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Tue Feb 02, 2010 9:22 am    Post subject: Reply with quote

I couldn't get %pm to do what I wanted either, and also wrote my own routine to create a pop-up window with a right mouse click over a graphics area. However I made the routine context sensitive when an entity under the cursor was being highlighted, and placed the pop-up menu just to the right of the cursor.

Quote:
I have no control of the location of this "pop-up"


John, as Dan indicated, it is not difficult to place the pop-up menu where you want it to be, using %sp.

To get the correct coordinates for the positioning, I use:-

GET_MOUSE_INFO@ (for %gr GDI graphics)

or

GET_OPENGL_MOUSE_STATE@ (for %og OpenGL graphics)

to get the mouse coordinates,

which I then combine with the window coordinates obtained using GET_WINDOW_LOCATION@

cheers,
John
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Feb 02, 2010 11:27 pm    Post subject: Reply with quote

Here is an example. If you remove full_mouse_input the %pm menu appears where it supposed to be. When it is there - %pm menu can be seen in different places, in this specific example in %ob/cb area.
Code:

      winapp
      include <windows.ins>
      integer  gr_func,mg_func
      external gr_func,mg_func
      character*40 cstat
      common cstat
      cstat=' '
      i=winio@('%ww[no_border]&')
      i=winio@('%ca[Sample]&')
      i=winio@('%mn[E&xit]&','EXIT')
      i=winio@('%pm[Exit]&','exit')
      i=winio@('%ob&')
      i=winio@('%mg&', WM_KEYDOWN, mg_func)
      i=winio@('%^gr[black,full_mouse_input]&',300,300,gr_func)
      i=winio@('%cb%ob[status]%20st%cb',cstat)
      end
c-----------------------------------------------------------
      integer function mg_func()
      include <windows.ins>
      integer wparam,i
      character*40 cstat
      common cstat
      integer key, get_wkey@
      save i
      data i/0/
      i=i+1

      key=get_wkey@()

      cstat(i:i)= char(key)
      call window_update@(cstat)
      if(i > 39) i=0
      mg_func=1
      end
c-----------------------------------------------------------
      integer function gr_func()
c     Process mouse keys here     
      gr_func=1
      end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 03, 2010 9:22 am    Post subject: Reply with quote

For the next release I have added a new %gr option [popup] that can be used with [full_mouse_input] in order to enable the %pm.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Feb 04, 2010 4:14 am    Post subject: Reply with quote

Thant's great.
I planned to post one Users Example where you can digitize arbitrary graph. There %pm is exactly such intuitive option which is needed as you will see when i get this option at hands
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