PromptString プロパティ(ActiveX)

属性の入力を求めるプロンプト文字列を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.PromptString
object

タイプ: Attribute

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 文字列

属性の入力を求めるプロンプト文字列

注意

プロンプト文字列は、属性を含むブロックが挿入された際に表示されます。この文字列の既定値は TagString プロパティです。プロパティに acAttributeModeConstant を入力すると、プロンプトは無効になります。

VBA:

Sub Example_PromptString()
    ' This example creates an attribute definition in a block.
    ' It then inserts the block. Then it changes the prompt string
    ' of the attribute definition, and inserts the block again.
    
    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "TEST")
    
    ' Add a circle to block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    ' Define the attribute definition
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Integer
    Dim prompt As String
    Dim tag As String
    Dim value As String
    
    height = 1#
    mode = acAttributeModeVerify
    prompt = "Enter value:"
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0
    tag = "Tag1"
    value = "Circle1"
    
    ' Create the attribute definition on the block
    Set attributeObj = blockObj.AddAttribute(height, mode, prompt, insertionPnt, tag, value)
    
    ' Insert the block
    Dim blockRefObj1 As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj1 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "TEST", 1#, 1#, 1#, 0)
        
    ' Change the prompt string and tag of the attribute definition
    attributeObj.PromptString = "Verify value:"
    
    ' Insert the block again
    Dim blockRefObj2 As AcadBlockReference
    insertionPnt(0) = 4#: insertionPnt(1) = 4#: insertionPnt(2) = 0
    Set blockRefObj2 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "TEST", 1#, 1#, 1#, 0)
    
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PromptString()
    ;; This example creates an attribute definition in a block.
    ;; It then inserts the block. Then it changes the prompt string
    ;; of the attribute definition, and inserts the block again.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "TEST"))
    
    ;; Add a circle to block
    (setq center (vlax-3d-point 0 0 0)
          radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 0 0 0) 
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "Enter value:"
          attTag "Tag1"
          attValue "Circle1")
    
    ;; Create the attribute definition on the block
    (setq attributeObj (vla-AddAttribute blockObj attHeight attMode attPrompt insertionPoint attTag attValue))
    
    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj1 (vla-InsertBlock modelSpace insertionPnt "TEST" 1 1 1 0))
        
    ;; Change the prompt string and tag of the attribute definition
    (vla-put-PromptString attributeObj "Verify value:")
    
    ;; Insert the block again
    (setq insertionPnt (vlax-3d-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj2 (vla-InsertBlock modelSpace insertionPnt "TEST" 1 1 1 0))
    
    (vla-ZoomAll acadObj)
)