Expressing VBA constants in vlisp

Discussion in 'AutoCAD' started by Jason Peterson, Feb 14, 2005.

  1. I'm having trouble finding any information on expressing certain VBA
    constants in vlisp. I have found in the Apropos results items like
    vlax-vbOK and vlax-vbNull, but what I need are the equivalents for vbRed,
    vbWhite, and vbBlack. I'd settle for expressing these items as their true
    values, but I'm not even sure how to do that, given that they seem to be
    numbers seperated by commas (ie. 255,0,0).

    Below is the code I'm trying to resolve.

    (vla-put-TextWinBackgrndColor (vla-get-Display (vla-get-Preferences
    (vlax-get-acad-object))) vbRed)

    I've tried expressing vbRed as vlax-vbRed, :vlax-vbRed, and (list 255 0 0).
    None have worked.

    Any ideas?

    Jason
     
    Jason Peterson, Feb 14, 2005
    #1
  2. Jason Peterson

    James Allen Guest

    Hi Jason,

    I'm pretty sure there's a way to have it translate in the background, but I
    don't remember what it is right now. But until someone is kind enough to
    remind us; probably some of this you already know:
    "vbaide" to open the vba editor
    view->object browser, or F2, to open the object browser
    Select vba in the top pull-down list
    Select ColorConstants in the Classes list
    Pick the color you're interested in and look at the bottom to see the actual
    value.
     
    James Allen, Feb 15, 2005
    #2
  3. Jason Peterson

    Jürg Menzi Guest

    Hi Jason

    VB related constants use the prefix:
    vlax-....
    vlax-vbInteger
    vlax-vbOkOnly

    AutoCAD related constants like colors, lineweights, etc. use:
    ac...
    acRed
    acLnWt005

    You will find the specific constants to a property or method in the help,
    eg:
    - ActiveX and VBA Reference -> Methods -> IntersectWith
    - ActiveX and VBA Reference -> Properties -> Color
    ....

    Cheers
     
    Jürg Menzi, Feb 15, 2005
    #3
  4. Jason Peterson

    BillZ Guest

    I use the true color number.

    (vlax-put-property (vla-get-display (vla-get-preferences (vlax-get-acad-object))) "GraphicsWinModelBackgrndColor" 16777215)

    Check out: C:\Program Files\AutoCAD 2005\Sample\VisualLISP\color-util.lsp for the various color number translators.

    HTH

    Bill
     
    BillZ, Feb 15, 2005
    #4
  5. James (and everyone else), thanks for the advice. I was able to look up the
    actual values and use those numbers.

    Jason
     
    Jason Peterson, Feb 15, 2005
    #5
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.