To keep it simple...
Replace the menugroup name and toolbar name with your own. Make a button with "TogTB" as the command.
Code:
(DEFUN c:togtb (/ |menugroups| |menugroup| |target| |toolbar| |state|
|visible|)
(SETQ |menugroups| (VLA-GET-MENUGROUPS (VLAX-GET-ACAD-OBJECT)))
(SETQ |menugroup| "n52")
(SETQ |toolbar| "Pop-up Toolbar")
(SETQ |target| (VL-CATCH-ALL-APPLY
'VLA-ITEM
(LIST |menugroups| |menugroup|)
) ;_ end of VL-CATCH-ALL-APPLY
) ;_ end of SETQ
(IF (EQ (TYPE |target|) 'vla-object)
(PROGN
(SETQ |visible| (VL-CATCH-ALL-APPLY
'VLAX-INVOKE-METHOD
(LIST
(VLAX-GET-PROPERTY |target| "Toolbars")
'item
|toolbar|
) ;_ end of list
) ;_ end of vl-catch-all-apply
) ;_ end of setq
(IF (EQ (TYPE |visible|) 'vla-object)
(PROGN
(SETQ |state| (VLA-GET-VISIBLE |visible|))
(IF (NOT (EQ |state| :VLAX-TRUE))
(VLA-FLOAT |visible| 400 500 9)
(VLA-PUT-VISIBLE |visible| :VLAX-FALSE)
) ;_ end of if
(VLAX-RELEASE-OBJECT |visible|)
) ;_ end of progn
(PRINC (STRCAT "\n Cannot find the " |toolbar| " toolbar! ")
) ;_ end of PRINC
) ;_ end of if
(VLAX-RELEASE-OBJECT |menugroups|)
) ;_ end of progn
(PRINC
(STRCAT "\n Cannot find the " |menugroup| " menugroup! ")
) ;_ end of PRINC
) ;_ end of if
(PRINC)
) ;_ end of defun
Longer answer later...