Change a toolbar icon at "run-time"

Discussion in 'AutoCAD' started by Toni, Jun 2, 2004.

  1. Toni

    Toni Guest

    Hello,

    I'd like to know if it's possible to change the icon of a toolbar
    command. I mean that, at run-time of an AutoLISP function, I want to call
    some function that would modify the bitmap of that icon.

    I've been reading about it and I discovered a VBA method called
    SetBitmaps. The on-line help says the following about that method: "Sets the
    large and small bitmaps used as icons for the toolbar item.". It would be
    nice if there would be some equivalent LISP function. Perhaps there is any
    way to call this VBA method "SetBitmaps" within LISP code?

    Thank you very much,
    .- Toni
     
    Toni, Jun 2, 2004
    #1
  2. Toni

    Jeff Guest

    This should give you the idea......

    (setq *acad (vlax-get-acad-object)
    mnus (vla-get-menugroups *acad)
    mnu (vla-item mnus "mymenu");menu name to work with
    tlbars (vla-get-toolbars mnu)
    )
    (setq tlbar (vla-item tlbars "tdg-arc"));toolbar name to work with
    (setq btn1 (vla-item tlbar 0));this gets the first button
    (vla-getbitmaps btn1 'bm1 'bm2)
    (setq bm3 "c:\\icons\\newIcon_16.bmp"
    bm4 "c:\\icons\\newIcon_24.bmp");;must be valid path to a valid bitmap
    (vla-setbitmaps btn1 bm3 bm4)

    Jeff
     
    Jeff, Jun 2, 2004
    #2
  3. Toni

    Toni Guest

    LOTS OF THANKS, Jeff!!!!!

    Now i've read in AutoCAD Help that "vla-" is a Lisp standard prefix to call
    ActiveX/VBA methods.

    Thanks again!

    .- Toni
     
    Toni, Jun 3, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.