Space bar is enter while typing text

Discussion in 'AutoCAD' started by sepult, Oct 12, 2004.

  1. sepult

    sepult Guest

    (getstring) allows a [Space Bar] or [Enter] key to terminate input, but we don't want it to.

    We have a a lisp that prompts for text, but if we use fractions (space bar to seperate) it enters out.

    is this a while statment or grread? we are not quite sure how to approach this.

    can anyone provide input.

    TIA
     
    sepult, Oct 12, 2004
    #1
  2. you really need to use the help in the Visual Lisp more.
    Type VLIDE to get the editor (which is great for lisp) and ho to the help.

    It reads:

    (getstring [cr] [msg])

    Arguments

    cr

    If supplied and not nil, this argument indicates that users can include blanks in their input string (and must terminate
    the string by pressing ENTER). Otherwise, the input string is terminated by space or ENTER.

    msg

    A string to be displayed to prompt the user.

    So rather than try to remember syntax, just look it up as needed.

    Hot tip:
    In the VL editor, double click before or after a parenthesis. It will highlight the block of code enclosed.
    Super slick for checking parens or copying around blocks of code.

    thx


    sepult <>
    |>(getstring) allows a [Space Bar] or [Enter] key to terminate input, but we don't want it to.
    |>
    |>We have a a lisp that prompts for text, but if we use fractions (space bar to seperate) it enters out.
    |>
    |>is this a while statment or grread? we are not quite sure how to approach this.
    |>
    |>can anyone provide input.
    |>
    |>TIA

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 12, 2004
    #2
  3. sepult

    moshe Guest

    Hi

    try:-

    (getstring T "\nAny prompt: ")

    the above format accept spaces & pause until 'Enter key' is press.

    Moshe
     
    moshe, Oct 12, 2004
    #3
  4. sepult

    Tom Smith Guest

    a) Getstring lets you specify whether or not a space acts as a carriage
    return, see help.

    b) Is it really "text" or a number that you're requesting? If it's a number,
    getdist can be more suitable, and more flexible by letting you either pick
    points or type a number. In that case you'd use a dash for fractional input
    as usual. Enter 1-1/2 and it returns 1.5, then use rtos to format it as you
    want.
     
    Tom Smith, Oct 12, 2004
    #4
  5. sepult

    sepult Guest

    Thanks guys.
    we got it.
     
    sepult, Oct 12, 2004
    #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.