DisplayLocked Property (ActiveX)

Specifies whether the viewport is locked.

Supported platforms: Windows only

Signature

VBA:

object.DisplayLocked
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DisplayLocked()
    ' This example scans the current drawing paper space Viewports
    ' and displays whether or not any of them are locked.
    
    Dim pviewportObj As Object
    Dim msg As String, DisplayState As String
    
    ' Make sure this drawing contains paper space viewports before continuing
    If ThisDrawing.PaperSpace.Count = 0 Then
        MsgBox "There are no paper space viewports in the current drawing."
        Exit Sub
    End If
    
    ' Go through each PViewport object in the drawing paper space
    ' and determine whether the paper space viewport is locked or not

    For Each pviewportObj In ThisDrawing.PaperSpace
        ' Determine if this is a paper space viewport
        If pviewportObj.ObjectName = "AcDbViewport" Then
            ' Determine if this paper space viewport is clipped
            DisplayState = IIf(pviewportObj.DisplayLocked, " is locked", " is not locked")
            msg = msg & "PViewport ID " & pviewportObj.ObjectID & DisplayState & vbCrLf
        End If
    Next

    ' Display locked state of paper space Viewports
    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayLocked()
    ;; This example scans the current drawing paper space Viewports
    ;; and displays whether or not any of them are locked.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq paperSpace (vla-get-PaperSpace doc))
  
    ;; Make sure this drawing contains paper space viewports before continuing
    (if (= (vla-get-count paperSpace) 0)
        (alert "There are no paper space viewports in the current drawing.")
        (progn
	           (setq msg "")
	           ;; Go through each paper space viewport object in the drawing paper space
	           ;; and determine whether or not it is locked
	           (vlax-for pviewportObj paperSpace
	               ;; Determine whether this is a paper space viewport
	               (if (= (vla-get-ObjectName pviewportObj) "AcDbViewport")
	                   (progn
	                       ;; Determine whether this paper space viewport is locked
	                       (setq DisplayState (if (= (vla-get-DisplayLocked pviewportObj) :vlax-true) " is locked" " is not locked"))
		                      (setq ID (itoa (vla-get-ObjectID pviewportObj)))
	                       (setq msg (strcat msg "PViewport ID " ID DisplayState "\n"))
	                   )
	               )
	           )

	           ;; Display locked state of paper space Viewports
	           (alert msg)
	       )
    )
)