Author Topic: Pops dropping out of the cui when loading an mns/mnu file  (Read 5904 times)

0 Members and 1 Guest are viewing this topic.

Steve Johnson

  • Guest
Re: Pops dropping out of the cui when loading an mns/mnu file
« Reply #30 on: May 02, 2008, 01:44:08 AM »
I could tell immediately by this line (command "MENULOAD") that you are using LISP
Did you also say that you use menu/cui load manually as well?
That may be a better idea.
Under normal circumstances, my code will do the partial menu loading. If I have a need to load a partial menu individually, I will use (command "MENULOAD" "MENUFILE") if I want no POPs to be automatically loaded, or plain MENULOAD if I do want them loaded.

Quote
So, that will load the cui into CAD but not populate the menubar at all, is that correct?
Correct for (command "MENULOAD"), yes, but not for manual use of MENULOAD.

Quote
Also, I did notice in VBA, that menubar is still available, so there may be a chance that I can load it and populate the menubar programmatically. That seems to be what you are doing.
I would expect the menu bar to continue to be available and programmable for a long time to come. Even if large number of 2009 users were not still using the traditional interface, the new Menu Browser needs it anyway.

Quote
I would be interested in seeing your LISP code if that is something that you are comfortable with.

Here's some example code I threw together. This is a simplified version of some production code that has its origins in 1994, and is provided here as-is and completely untested:

Code: [Select]
; Example call
;(load_partial_menu_example
;  "MYMENU"   ; Filename of menu, no extension, can include path
;  "MYGROUP"  ; Name of menu group
;  "ID_MINE"  ; ID of any POP menu item
;  '(1)       ; POP number(s) of pull-downs to load
;)
;
; Example MYMENU.mnu contents
;
;***MENUGROUP=MYGROUP
;
;***POP1
;ID_XXX           [My Menu]
;ID_MINE          [My First Command]^C^CWhatever
;                 [Other command]^C^CSomething


(defun load_partial_menu_example (FNAME MGROUP ID POPLIST
                                  / penultimate_menu)

  (defun penultimate_menu (/ #)
    (setq # 1)
    (while (menucmd (strcat "P" (itoa #) ".1=?"))
      (setq # (1+ #))
    )
    (- # 1) ; Location before Help pull-down
  ) ; End penultimate_menu

; Start load_partial_menu_example

  (while (not (menucmd "P1.1=?"))) ; Wait for menu to load before acting (R13 bug workaround)
  (if (not (menucmd (strcat "G" MGROUP "." ID "=?"))) ; Only load if not already there
    (progn
      (command) ; Cancel anything else
      (if (findfile (strcat FNAME ".cui")) ; Give priority to CUI file if found
        (command "_.CUILOAD" (strcat FNAME ".cui"))
        (command "_.MENULOAD" FNAME)
      )
      (foreach pop POPLIST ; Load pull-downs as required
        (menucmd
          (strcat
            "P" (itoa (penultimate_menu)) "=+" MGROUP ".POP" (itoa pop)
          )
        )
      )
    )
  )
  (princ)
) ; End load_partial_menu_example

ML

  • Guest
Re: Pops dropping out of the cui when loading an mns/mnu file
« Reply #31 on: May 02, 2008, 10:58:02 AM »
Hey Steve

This is good to know
Quote
Correct for (command "MENULOAD"), yes, but not for manual use of MENULOAD.

Thank you for The LISP, I only know a very limited amount of LISP but I did find my old Menu.dvb file last night at home
That is my VBA project.
I think I will try to bring that up to date.

Any interest in VBA?

Mark

Steve Johnson

  • Guest
Re: Pops dropping out of the cui when loading an mns/mnu file
« Reply #32 on: May 05, 2008, 08:54:28 AM »
Any interest in VBA?
Not really, sorry. Although I did a technical review job on an AutoCAD VBA book a couple of years ago.

ML

  • Guest
Re: Pops dropping out of the cui when loading an mns/mnu file
« Reply #33 on: May 05, 2008, 09:44:57 AM »

Don't be sorry; no hard feelings :)
LISP has its place in the world; that is the world of ACAD
Do you do any VLISP?

With VLISP you can at least connect to some external librarie types like you can with VBA

Mark