ユーザから整数値を取得します。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.GetInteger([Prompt])
タイプ: Utility
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ; オプション
タイプ: バリアント型(文字列)
ユーザに入力を求めるときに表示される文字列。
タイプ: 長整数型
ユーザから返される整数値
AutoCAD はユーザから整数が入力されるのを待って、選択した値に対する戻り値を設定します。パラメータ Prompt は、ユーザ入力を求める際に AutoCAD が表示する文字列を指定します。Prompt は、オプションです。
入力できる整数は、-32,768 ~ 32,767 までの有効な(短整数型)整数です。
整数ではなくキーワードが返されたり、ユーザが値を入力せずに[Enter]キーを押した場合には、AutoCAD はエラー番号 -2145320928 (と、「ユーザ入力がキーワードです」というエラー メッセージ)を生成します。GetInput メソッドを使用して、戻り値からキーワードを取得します。
VBA:
Sub Example_GetInteger()
' This example returns the integer entered by the user.
AppActivate ThisDrawing.Application.Caption
Dim returnInt As Integer
' Return the value entered by user. A prompt is provided.
returnInt = ThisDrawing.Utility.GetInteger("Enter an integer: ")
MsgBox "The integer entered was " & returnInt & vbCrLf & _
"(Enter the next value without prompting.)", , "GetInteger Example"
' Return the value entered by user. No prompt is provided.
returnInt = ThisDrawing.Utility.GetInteger()
MsgBox "The integer entered was " & returnInt, , "GetInteger Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_GetInteger()
;; This example returns the integer entered by the user.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Return the value entered by user. A prompt is provided.
(setq returnInt (vla-GetInteger (vla-get-Utility doc) "Enter an integer: "))
(alert (strcat "The integer entered was " (itoa returnInt)
"\n(Enter the next value without prompting.)"))
;; Return the value entered by user. No prompt is provided.
(setq returnInt (vla-GetInteger (vla-get-Utility doc)))
(alert (strcat "The integer entered was " (itoa returnInt)))
)