Method Get Mouse Over a control

Started by stephan_35, October 19, 2009, 02:22:31 AM

Previous topic - Next topic

Are you interested in a method that provides the position of the mouse position

Yes, great idea!
11 (84.6%)
Yes, but not immediately
1 (7.7%)
No, i don't see
1 (7.7%)
Not a good idea
0 (0%)

Total Members Voted: 13

stephan_35

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.

OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

Have you tried to use (dcl_GetMouseCoords) to achieve this?

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

stephan_35

Quote from: owenwengerd on October 19, 2009, 09:06:19 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.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

stephan_35

Quote from: 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

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.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

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.

BazzaCAD

#6
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
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

I'll play around with (dcl_GetMouseCoords) a little more to see if I can get better results.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

BazzaCAD

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.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

stephan_35

Quote from: BazzaCAD on October 20, 2009, 10:22:55 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.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

Kerry

Perfection is not optional.
My other home is TheSwamp

Fred Tomke

Quote from: 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.

Hi Owen,

the great Barry has posted it here.
You are right - he is very clever!  :)

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

I've collected all the knowledge and built an FAQ for this.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

andrew

this seems like a pretty neat thing
i think ill mess around with this  :o

honkinberry

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

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]