getkword and ( )

Discussion in 'AutoCAD' started by Jason Piercey, Jul 9, 2003.

  1. Just noticing this....

    (defun c:test ()
    (initget "A B")
    (getkword "\n[A(1)/B(2)]testing:")
    )

    and give a right click and select an option.. :(

    So, what other characters make strange things happen?

    I really wanted to use the ( ). I am building prompts on the
    fly and within the set of ( ) was just some extra info for the
    user about that particular keyword.
     
    Jason Piercey, Jul 9, 2003
    #1
  2. Jason Piercey

    Rudy Tovar Guest

    Didn't understand the question at first, but perhaps an alternative method
    could be applied.

     
    Rudy Tovar, Jul 9, 2003
    #2
  3. Jason Piercey

    Rudy Tovar Guest

    I would suggest writing to a file, and loading the temp file each time on
    the fly.

     
    Rudy Tovar, Jul 9, 2003
    #3
  4. Not sure I follow you there.. I may end up not using
    (getkword), not because of the right click problem but due
    to the keywords. They are numbers in this case, and would
    like to be able to enter a decimal value or a value expressed
    in the current unit format.
     
    Jason Piercey, Jul 9, 2003
    #4
  5. Hi Kelie,

    That is the problem, using a set of ( ) in a keyword or within a
    set of [ ] at the prompt, makes the right click options useless.
     
    Jason Piercey, Jul 9, 2003
    #5
  6. Jason Piercey

    Mark Propst Guest

    did you try {} ? or <> ? or [] ?

     
    Mark Propst, Jul 9, 2003
    #6
  7. Yeah, I fiddled with 'em for a while... [ ] already serves
    a purpose within the right click, don't like the way the
    others read in a prompt so I decided to just (princ) an
    extra line before the user prompt to get essentially the
    same effect. (princ)ing the extra line is more than likely
    what I should have been doing in the first place.
     
    Jason Piercey, Jul 9, 2003
    #7
  8. Jason Piercey

    Kelie Guest

    Sorry Jason I'm not following you.
    Are you saying if you change the code to

    (defun c:test ()
    (initget "A B")
    (getkword "\n[A1/B2]testing:") ;;; or simply (getkword "\ntesting:")
    )

    You can right-click to choose "A" or "B"? Where do you right-click? In
    command line? I can't make it
    happen.



     
    Kelie, Jul 10, 2003
    #8
  9. (defun c:test ()
    (initget "A B")
    (getkword "\n[A/B]testing:")
    )

    while c:test is running right click in the drawing area
    and you will have the A and B option listed. The
    [ / ] format makes that a possibility.

    What I noticed was that using a set of ( ) in the user prompt
    and/or in the call to (initget), the right click no longer works.
    Just something "funny" about those characters and (initget)

    this fails.

    (defun c:test ()
    (initget "(A) (B)")
    (getkword "\n[(A)/(B)]testing:")
    )
     
    Jason Piercey, Jul 10, 2003
    #9
  10. Jason,

    Give this a try:

    (defun C:Test ()
    (initget "A B")
    (getkword "\nTesting tricky prompts [A (one)/B (two)]: "))


    The trick is that you don't want to complicate your keywords, only inform
    the user (via the prompt).


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | (defun c:test ()
    | (initget "A B")
    | (getkword "\n[A/B]testing:")
    | )
    |
    | while c:test is running right click in the drawing area
    | and you will have the A and B option listed. The
    | [ / ] format makes that a possibility.
    |
    | What I noticed was that using a set of ( ) in the user prompt
    | and/or in the call to (initget), the right click no longer works.
    | Just something "funny" about those characters and (initget)
    |
    | this fails.
    |
    | (defun c:test ()
    | (initget "(A) (B)")
    | (getkword "\n[(A)/(B)]testing:")
    | )
    |
    |
    | --
    |
    | -Jason
    | Member of the Autodesk Discussion Forum Moderator Program
    |
    |
    | > Sorry Jason I'm not following you.
    | > Are you saying if you change the code to
    | >
    | > (defun c:test ()
    | > (initget "A B")
    | > (getkword "\n[A1/B2]testing:") ;;; or simply (getkword "\ntesting:")
    | > )
    | >
    | > You can right-click to choose "A" or "B"? Where do you right-click? In
    | > command line? I can't make it
    | > happen.
    |
    |
     
    R. Robert Bell, Jul 10, 2003
    #10
  11. Good 'nuff. ;-)
     
    R. Robert Bell, Jul 10, 2003
    #11
  12. don't think it has anything to do with spaces...

    this works (without spaces)
    (defun C:Test ()
    (initget "A B")
    (getkword "\nTesting tricky prompts [A(one)/B(two)]: "))


    this does not (without spaces)
    (defun C:Test ()
    (initget "A B")
    (getkword "\nTesting tricky prompts [A(One)/B(Two)]: "))


    nor does this (without spaces)
    (defun C:Test ()
    (initget "A B")
    (getkword "\nTesting tricky prompts [A(1)/B(2)]: "))


    nor does this (with spaces)
    (defun C:Test ()
    (initget "A B")
    (getkword "\nTesting tricky prompts [A (One)/B (Two)]: "))

    guess I wasn't realizing that the number inside ( ) (or capital letter)
    was the culprit, not the set of ( ).

    I have since gone to another print statement anyhow, it works
    out for the better in more than one way for me. Don't know what
    I was thinking (not an uncommon thing :)
     
    Jason Piercey, Jul 10, 2003
    #12
  13. Jason Piercey

    Kelie Guest

    Thanks Jason. I've been using getkword for a while. Never knew I have the
    right-click option here.


     
    Kelie, Jul 10, 2003
    #13
  14. Jason Piercey

    Kevin Nehls Guest

    You have to use the [] brackets though instead of the old <> brackets
    generally used to specify the options to get the right-click options in
    there though.
     
    Kevin Nehls, Jul 10, 2003
    #14
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.