New OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: stephan_35 on October 19, 2009, 02:22:31 AM

Title: Method Get Mouse Over a control
Post by: stephan_35 on October 19, 2009, 02:22:31 AM
Hello,

Still blocked with getting the mouse position over a control.

Why ?

I would like to build a RightClick menu over a treecontrol, that need to know where is the mouse over it to know where appear the new menu.

Yes, I know there is the OnMouseMove Event, but always add lines in AutoCad Command Lines, then need to put to synchronous invoke, that makes drag and drop to autocad failed !!!

So, i need to get the mouse position with a function which will be call when it need to .

Thanks for help.

Best regards.

Title: Re: Method Get Mouse Over a control
Post by: owenwengerd on October 19, 2009, 09:06:19 AM
Have you tried to use (dcl_GetMouseCoords) to achieve this?
Title: Re: Method Get Mouse Over a control
Post by: Fred Tomke on October 19, 2009, 10:57:38 PM
Hi, but this strikes in the right direction.
I can remember that somewhere in the early times there was an example of a board member showing how to call a context menu using "menucmd" after right click in a tree or listview. I tried to find it but I couldn't yet. Is there someone out there who is familiar with menucmd?

Fred
Title: Re: Method Get Mouse Over a control
Post by: stephan_35 on October 20, 2009, 03:36:16 AM
Have you tried to use (dcl_GetMouseCoords) to achieve this?

Thanks a lot owen !

This is the best soluce of my problem !

Best regards.
Title: Re: Method Get Mouse Over a control
Post by: stephan_35 on October 20, 2009, 03:41:43 AM
Hi, but this strikes in the right direction.
I can remember that somewhere in the early times there was an example of a board member showing how to call a context menu using "menucmd" after right click in a tree or listview. I tried to find it but I couldn't yet. Is there someone out there who is familiar with menucmd?

Fred

Thanks fred for reply.

Using menucmd could be another way , but seem to be hard to cutomise the context menu, depending of selected item.

Keep this in my mind  ;)

Best regards.
Title: Re: Method Get Mouse Over a control
Post by: owenwengerd on October 20, 2009, 05:22:36 AM
Fred, I also remember a post about this, but I could not find it. As I recall, I thought it was very clever, but I never used it myself.
Title: Re: Method Get Mouse Over a control
Post by: BazzaCAD on October 20, 2009, 09:45:00 AM
Are you referring to my 'clever' code?
Looks like I posted it over at SF before we stated the forums.
https://sourceforge.net/projects/opendcl/forums/forum/658811/topic/1868759 (https://sourceforge.net/projects/opendcl/forums/forum/658811/topic/1868759)
It works ok, but will only work on Modeless forms & is a pain to deal with since you have to edit the CUI(x)

I'd still prefer having a Right-Click menu control built into OpenDCL.
https://sourceforge.net/tracker/?func=detail&aid=1682530&group_id=187950&atid=923366 (https://sourceforge.net/tracker/?func=detail&aid=1682530&group_id=187950&atid=923366)

I'll play around with (dcl_GetMouseCoords) a little more to see if I can get better results.
Title: Re: Method Get Mouse Over a control
Post by: BazzaCAD on October 20, 2009, 10:22:55 AM
OK I did a quick test and this is working ok...
I just added this code:
Code: (autolisp) [Select]
  (setq MouseCoords (dcl_GetMouseCoords))
  (dcl_Form_Show TMaCAD_RCM (car MouseCoords) (cadr MouseCoords))

(defun c:TMaCAD_RCM_GraphicButton1_OnClicked (/)
 (dcl_Form_close TMaCAD_RCM)
)

(defun c:TMaCAD_RCM_GraphicButton2_OnClicked (/)
 (dcl_Form_close TMaCAD_RCM)
)

It's not perfect, for example if you don't click on the RCM, it stays up, so a built-in solution would still be preferred.
Title: Re: Method Get Mouse Over a control
Post by: stephan_35 on October 20, 2009, 11:50:56 AM
It's not perfect, for example if you don't click on the RCM, it stays up, so a built-in solution would still be preferred.

I did it as like you, i just add an OnMouseMovedOff Event

Code: (autolisp) [Select]
(defun c:BOX_RightClick_OnMouseMovedOff (/)
  (dcl_Form_Close BOX_RightClick)
)

Best regards.
Title: Re: Method Get Mouse Over a control
Post by: Kerry on October 20, 2009, 01:10:42 PM
James posted some here
http://www.theswamp.org/index.php?topic=25357.0 (http://www.theswamp.org/index.php?topic=25357.0)
http://www.theswamp.org/index.php?topic=25896.msg311909#msg311909 (http://www.theswamp.org/index.php?topic=25896.msg311909#msg311909)
I haven't had a good look at it though.
Title: Re: Method Get Mouse Over a control
Post by: Fred Tomke on January 15, 2010, 02:36:47 AM
Fred, I also remember a post about this, but I could not find it. As I recall, I thought it was very clever, but I never used it myself.

Hi Owen,

the great Barry has posted it here (http://sourceforge.net/projects/opendcl/forums/forum/658811/topic/1868759?message=4621323).
You are right - he is very clever!  :)

Fred
Title: Re: Method Get Mouse Over a control
Post by: Fred Tomke on January 15, 2010, 01:10:37 PM
I've collected all the knowledge and built an FAQ for this (http://www.opendcl.com/forum/index.php?topic=1135.0).

Fred
Title: Re: Method Get Mouse Over a control
Post by: andrew on January 18, 2010, 01:32:33 PM
this seems like a pretty neat thing
i think ill mess around with this  :o
Title: Re: Method Get Mouse Over a control
Post by: honkinberry on December 18, 2012, 04:32:09 PM
I finally got around to trying and work in a context menu into some of our dialogs.
In attempting to implement this, I'm having some difficulty.  It seems it requires the dialog to be Modeless, correct?  Can it work with a Modal form?

--J
Title: Re: Method Get Mouse Over a control
Post by: Fred Tomke on December 18, 2012, 09:20:47 PM
Hi, honestly, I must say that I haven't tried it yet in modal forms. I cannot say whether menucmd needs full access to AutoCAD.
Regards, Fred
Title: Re: Method Get Mouse Over a control
Post by: honkinberry on December 19, 2012, 09:12:34 AM
It most certainly does require the form to be Modeless.
I'd just recommend declaring that in the sample code.

As an alternative for Modal forms, I have a modal form without a title bar, and mousemove events that toggle the visibility of Frames around the text items.  It doesn't have the nice transparent blue highlight of a menu, but looks fairly sharp.  It should hold until I can get my primary dialogs converted to Modeless.

--J