Author Topic: creating popup menu?  (Read 10401 times)

0 Members and 1 Guest are viewing this topic.

FengK

  • Guest
creating popup menu?
« on: January 31, 2009, 02:36:44 AM »
Hello,

Is there some function(s)/way(s) in OpenDCL that allows to create a popup menu? I searched the help file and didn't find one. Currently I'm using the dos_popupmenu function from doslib, but it doesn't allow for nested menu items. To get around this limit, I had to modify a preloaded menu group. (James B should have the credit, coz the idea was from him.) It works, but I was looking for an easier way. Thanks.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: creating popup menu?
« Reply #1 on: February 02, 2009, 09:33:43 AM »
I've created really great pop-menu type dialogs with opendcl.  use the titlebar visible property, dcl_getmousecoords (sorry I don't remember the actual func. call) and the mouse moved off event to create dialogs that act like pop-up menus.  This gives you the ability to use all opendcl controls on the pop-up.  really saves screen space too.
James Buzbee
Windows 8

FengK

  • Guest
Re: creating popup menu?
« Reply #2 on: February 03, 2009, 12:28:27 PM »
Jame, thanks for your input and another great idea. I'd try it out.

FengK

  • Guest
Re: creating popup menu?
« Reply #3 on: March 19, 2009, 04:53:49 AM »
James, i had given this idea a try and it didn't look nice. Which control did you use to place the menu items? I used a list box. But it is hard to created nested popup menu with it. Also it appears list box does not have a "itemClicked" event. I wanted it behave the way an AutoCAD popup menu does: when mouse hover over an item, its background color changes to blue; when an item is clicked, some command gets executed. List box doesn't seem to fit the bill here. Also, i don't know how to simulate the effect of a separator.

Thanks!
« Last Edit: March 19, 2009, 04:59:44 AM by xycadd »

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: creating popup menu?
« Reply #4 on: March 19, 2009, 10:28:26 AM »
James Buzbee
Windows 8

FengK

  • Guest
Re: creating popup menu?
« Reply #5 on: April 08, 2009, 03:54:31 AM »
Have you tried this?

http://www.theswamp.org/index.php?topic=9306.0

Thanks. Yes. I've been using this method for a while and remember giving you credit for showing the example in one of the discussions here.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: creating popup menu?
« Reply #6 on: April 08, 2009, 08:55:21 AM »
Have you tried this?

http://www.theswamp.org/index.php?topic=9306.0
i found this a while back, just digging around and never got a chance to compliment/thank you. i compiled a few popup menus, and use them daily. brilliant stuff, thanks a million.

btw, i was curious if it would hurt the acad.cui, so i used it and have never seen any problems. granted, i'm running c3d, so my main cui is the civil.cui. that could also be it.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: creating popup menu?
« Reply #7 on: April 08, 2009, 11:37:01 AM »
Interesting.  When I first wrote this it was back in the .mns / .mnu days.  I wonder if the .cui "knows" when it's being manipulated and can reset itself accordingly?

You guys are very welcome.  Funny how the really simple tools are so effective.   :wink:
James Buzbee
Windows 8

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: creating popup menu?
« Reply #8 on: April 20, 2011, 02:31:56 PM »
I know this is a REALLY old thread but I had need to add a popup menu to an OpenDCL app I'm writing today and found DOSLib's dos_popupmenu a perfect solution.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: creating popup menu?
« Reply #9 on: April 20, 2011, 03:43:30 PM »
I know this is a REALLY old thread but I had need to add a popup menu to an OpenDCL app I'm writing today and found DOSLib's dos_popupmenu a perfect solution.
I've been using that one quite a bit - very useful.

Here's one I did for quickly accessing some of the topo/surface tools:
Code: [Select]
(defun c:C3TP (/ lst opt)
  (if (setq opt (dos_popupmenu
                  (mapcar (function car)
                          (setq lst '(("Flip Face" . "EditSurfaceSwapEdge")
                                      ("")
                                      ("Add Line" . "AddSurfaceLine")
                                      ("Delete Line" . "DeleteSurfaceLine")
                                      ("")
                                      ("Add Point" . "AddSurfacePoint")
                                      ("Delete Point" . "DeleteSurfacePoint")
                                     )
                          )
                  )
                  (mapcar (function (lambda (x)
                                      (if (eq "" (car x))
                                        1
                                        0
                                      )
                                    )
                          )
                          lst
                  )
                )
      )
    (progn (while (eq 1 (logand 1 (getvar 'CMDACTIVE))) (command))
           (command (strcat "_." (cdr (nth opt (vl-remove '("") lst)))))
    )
  )
  (princ)
)

I have the command programmed into one of my programmable keyboard keys (I use the old Gateway2000 Anykey Keyboard) so I can quickly execute it.

Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: creating popup menu?
« Reply #10 on: April 20, 2011, 04:06:47 PM »
For what it's worth, I created a custom popup menu (context sensitive) by modifying the CUI (MEP 2008).  So, depending on what type of object is selected and/or what layer it's drawn on, I can select the MY ADD SELECTED command and it will perform an object/layer specific command.

And attached is a CUI for Civil 3D specific commands (based on what you select).  I forget who created it.... maybe the AVAT in the shortcut menus is some sort of clue.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: creating popup menu?
« Reply #11 on: April 21, 2011, 09:17:43 AM »
For what it's worth, I created a custom popup menu (context sensitive) by modifying the CUI (MEP 2008). 

I won't touch the CUI sh*t, it's just too problematic IMO -- that's why I'm using OpenDCL palettes -- completely independent of the CUI. Thanks anyway. :)

I've been using that one quite a bit - very useful.

Indeed, nicely done. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: creating popup menu?
« Reply #12 on: April 21, 2011, 10:11:26 AM »
I've been using that one quite a bit - very useful.

Indeed, nicely done. :)
Thanks Michael. :)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox