Jump to content

Calling a toolbar, palette or ribbon by menucmd


Ahankhah

Recommended Posts

What is the symbol for Toolbar menus in menucmd:unsure:?

As I remember, there was no toolbar menu when the function established, and even now there is no extensions about toolbar menus, palettes and ribbons:?.

Is there any other way to manipulate toolbars visibility through AutoLISP?

Any help is appreciated.

Link to comment
Share on other sites

Look into the Toolbars Collection of a specific Menu Group.

 

For example to retrieve the Collection of all Toolbars in the ACAD MenuGroup:

 

(vla-get-toolbars (vla-item (vla-get-menugroups (vlax-get-acad-object)) "ACAD"))

 

Then, to look at specific Toolbars within that Collection:

 

(vla-item
 (vla-get-toolbars
   (vla-item (vla-get-menugroups (vlax-get-acad-object)) "ACAD")
 )
 "Modify"
)

 

Which returns a Collection of ToolbarItems within that Toolbar, we can investigate each item and separator also:

 

(vla-item
 (vla-item
   (vla-get-toolbars
     (vla-item (vla-get-menugroups (vlax-get-acad-object)) "ACAD")
   )
   "Modify"
 )
 "Erase"
)

 

[ Note that in all of these examples we could have iterated through the collection using vlax-for ]

 

Each ToolbarItem Object (and indeed, each of the Collection Objects) have associated properties and methods which you can investigate either using the VLIDE Help Documentation or the vlax-dump-object function.

 

Lee

Link to comment
Share on other sites

Thanks a lot Lee,

that is a very good tutorial,

but still one question remains: How is it possible to show a toolbar in screen (set visible attribute to it)?

Link to comment
Share on other sites

How is it possible to show a toolbar in screen (set visible attribute to it)?

 

Did you investigate the properties and methods of each of the objects described above?

Link to comment
Share on other sites

Did you investigate the properties and methods of each of the objects described above?
Of course yes:).

The biggest problem for me is the lack of a help for them (something like Visual LISP help).

Edited by Ahankhah
Link to comment
Share on other sites

Of course yes:).

The biggest problem for me is the lack of a help for them (something like Visual LISP help).

 

I'm not sure if ADesk removed the VBA help from the VLIDE Help Docs in ACAD2012, but certainly in 2010, almost every property/method has documentation.

 

Hence, after a little investigation of the Toolbar Object, we notice:

 

; IAcadToolbar: An AutoCAD toolbar
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00be91b4>
;   Count (RO) = 17
;   DockStatus (RO) = 3
;   FloatingRows = 1
;   Height (RO) = 490
;   HelpString = "Modify Toolbar\n    "
;   LargeButtons (RO) = 0
;   left = 0
;   Name = "Modify"
;   Parent (RO) = #<VLA-OBJECT IAcadToolbars 19a54f5c>
;   TagString (RO) = "ID_TbModify"
;   top = 0
[color=red];   Visible = -1[/color]
;   Width (RO) = 32
; Methods supported:
;   AddSeparator (1)
;   AddToolbarButton (5)
;   Delete ()
;   Dock (1)
;   Float (3)
;   Item (1)

And so the associated function would be

 

(vla-put-visible <object> <:vlax-true / :vlax-false>)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...