Input Options for User-Input Functions

The following table summarizes the control bits that can be specified by the val argument. To set more than one condition at a time, add the values together to create a val value between 0 and 127. If val is set to zero, none of the control conditions apply to the next user-input function call.

Note: Future versions of AutoCAD or ObjectARX may define additional acedInitGet() control bits, so you should avoid setting any bits that are not shown in the table or described in this section.

Input options set by acedInitGet() 

   

Code

Bit Value

Description

RSG_NONULL

1

Disallow null input

RSG_NOZERO

2

Disallow zero values

RSG_NONEG

4

Disallow negative values

RSG_NOLIM

8

Do not check drawing limits, even if LIMCHECK is on

RSG_DASH

32

Use dashed lines when drawing rubber-band line or box

RSG_2D

64

Ignore Z coordinate of 3D points (acedGetDist() only)

RSG_OTHER

128

Allow arbitrary input—whatever the user enters

The following program excerpt shows the use of acedInitGet() to set up a call to the acedGetInt() function.

int age; 
acedInitGet(RSG_NONULL | RSG_NOZERO | RSG_NONEG, NULL); 
acedGetInt("How old are you? ", &age);

This sequence asks the user's age. AutoCAD automatically displays an error message and repeats the prompt if the user tries to enter a negative or zero value, press ENTER only, or enter a keyword. (AutoCAD itself rejects attempts to enter a value that is not an integer.)

The RSG_OTHER option lets the next user-input function call accept arbitrary input. If RSG_OTHER is set and the user enters an unrecognized value, the acedGetxxx() function returns RTKWORD, and the input can be retrieved by a call to acedGetInput(). Because spaces end user input just as ENTER does, the arbitrary input never contains a space. The RSG_OTHER option has the lowest priority of all the options listed in the preceding table; if the acedInitGet() call has disallowed negative numbers with RSG_NONEG, for example, AutoCAD still rejects these.

The following code allows arbitrary input (the error checking is minimal).

int age, rc; 
char userstring[511]; 
acedInitGet(RSG_NONULL | RSG_NOZERO | RSG_NONEG | RSG_OTHER, 
    "Mine Yours"); 
if ((rc = acedGetInt("How old are you? ", &age)) 
    == RTKWORD) 
// Keyword or arbitrary input  
    acedGetInput(userstring); 
} 

In this example, acedGetInt() returns the values shown in the following table, depending on the user's input.

Arbitrary user input 

 

User Input

Result

41

acedGetInt() returns RTNORM and sets age to 41

m

acedGetInt() returns RTKWORD, and acedGetInput() returns “Mine”

y

acedGetInt() returns RTKWORD, and acedGetInput() returns “Yours”

twenty

acedGetInt() returns RTKWORD, and acedGetInput() returns “twenty”

what???

acedGetInt() returns RTKWORD, and acedGetInput() returns “what???”

-10

AutoCAD rejects this input and redisplays the prompt, as RSG_NONEG is set (other bit codes take precedence over RSG_OTHER)

-34.5

acedGetInt() returns RTKWORD, and acedGetInput() returns

“-34.5”

AutoCAD doesn't reject this value, because it expects an integer, not a real value (if this were an acedGetReal() call, AutoCAD would accept the negative integer as arbitrary input but would reject the negative real value)

Note: The acedDragGen() function indicates arbitrary input (if this has been enabled by a prior acedInitGet() call) by returning RTSTR instead of RTKWORD.