Poll

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

Yes, great idea!
10 (83.3%)
Yes, but not immediately
1 (8.3%)
No, i don't see
1 (8.3%)
Not a good idea
0 (0%)

Total Members Voted: 12

Author Topic: Method Get Mouse Over a control  (Read 10247 times)

stephan_35

  • Local Language Project Manager
  • Full Member
  • ****
  • Posts: 238
  • Stévanovich
Method Get Mouse Over a control
« 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.

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

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3007
    • Outside The Box
Re: Method Get Mouse Over a control
« Reply #1 on: October 19, 2009, 09:06:19 AM »
Have you tried to use (dcl_GetMouseCoords) to achieve this?

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2058
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Method Get Mouse Over a control
« Reply #2 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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

stephan_35

  • Local Language Project Manager
  • Full Member
  • ****
  • Posts: 238
  • Stévanovich
Re: Method Get Mouse Over a control
« Reply #3 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.
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

  • Local Language Project Manager
  • Full Member
  • ****
  • Posts: 238
  • Stévanovich
Re: Method Get Mouse Over a control
« Reply #4 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.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3007
    • Outside The Box
Re: Method Get Mouse Over a control
« Reply #5 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.

BazzaCAD

  • OpenDCL Webmaster
  • Administrator
  • Hero Member
  • *****
  • Posts: 853
  • Cylons will kill you
    • OpenDCL
Re: Method Get Mouse Over a control
« Reply #6 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
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.
« Last Edit: October 20, 2009, 10:29:11 AM by BazzaCAD »
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

BazzaCAD

  • OpenDCL Webmaster
  • Administrator
  • Hero Member
  • *****
  • Posts: 853
  • Cylons will kill you
    • OpenDCL
Re: Method Get Mouse Over a control
« Reply #7 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.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

stephan_35

  • Local Language Project Manager
  • Full Member
  • ****
  • Posts: 238
  • Stévanovich
Re: Method Get Mouse Over a control
« Reply #8 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.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

Kerry

  • Mesozoic Relic
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
  • class keyThumper<T>
Re: Method Get Mouse Over a control
« Reply #9 on: October 20, 2009, 01:10:42 PM »
Perfection is not optional.
My other home is TheSwamp

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2058
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Method Get Mouse Over a control
« Reply #10 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.
You are right - he is very clever!  :)

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

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

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2058
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Method Get Mouse Over a control
« Reply #11 on: January 15, 2010, 01:10:37 PM »
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

  • Full Member
  • ***
  • Posts: 185
Re: Method Get Mouse Over a control
« Reply #12 on: January 18, 2010, 01:32:33 PM »
this seems like a pretty neat thing
i think ill mess around with this  :o

honkinberry

  • Full Member
  • ***
  • Posts: 157
Re: Method Get Mouse Over a control
« Reply #13 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

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2058
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Method Get Mouse Over a control
« Reply #14 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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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