←Select platform

UnlockObject Event

Summary
Occurs when an AnnObject is unlocked.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public event EventHandler<AnnLockObjectEventArgs> UnlockObject 
- (void)automation:(LTAnnAutomation *)automation unlockObject:(LTAnnLockObjectEventArgs *)args; 
public void addUnlockEventListener(AnnUnlockEventListener listener) 
public void removeUnlockEventListener(AnnUnlockEventListener listener) 
public:  
   event EventHandler<AnnLockObjectEventArgs^>^ UnlockObject 
def UnlockObject(sender,e): # sender: AnnAutomation e: Leadtools.Annotations.Engine.AnnLockObjectEventArgs 
Event Data

The event handler receives an argument of type AnnLockObjectEventArgs containing data related to this event. The following AnnLockObjectEventArgs properties provide information specific to this event.

PropertyDescription
Cancel Gets or sets a value indicating whether the lock operation should be canceled.
Remarks

This event will occur on a successful call to Unlock.

Example
C#
using Leadtools.Annotations.Automation; 
 
using Leadtools.Annotations.Engine; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Annotations.WinForms; 
 
public void AnnAutomation_Lock() 
{ 
   // first add a new object to the automation 
   AnnRectangleObject rectObj = new AnnRectangleObject(); 
   rectObj.Rect = LeadRectD.Create(100, 100, 800, 800); 
   rectObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(1)); 
   rectObj.Fill = AnnSolidColorBrush.Create("Yellow"); 
   _automation.Container.Children.Add(rectObj); 
 
   _automation.Invalidate(LeadRectD.Empty); 
 
   // make sure no objects are selected in the automation 
   _automation.SelectObject(null); 
 
   // Hook to the lock and unlock events 
   _automation.LockObject += _automation_LockObject; 
   _automation.UnlockObject += _automation_UnlockObject; 
 
   // see if we can lock or unlock the object (this should show a message informing you that no objects are currently selected (bring edited) 
   LockUnlock(_automation); 
 
   // select (edit) the object we have just added 
   _automation.SelectObject(rectObj); 
 
   // see if we can lock or unlock the object (should show the password dialog to lock the object) 
   LockUnlock(_automation); 
 
   _automation.LockObject -= _automation_LockObject; 
   _automation.UnlockObject -= _automation_UnlockObject; 
} 
 
private void LockUnlock(AnnAutomation automation) 
{ 
   // first, check if we can lock the object 
   if (automation.CanLock) 
   { 
      // lock this object 
      automation.Lock(); 
   } 
   else if (automation.CanUnlock) 
   { 
      // unlock this object 
      automation.Unlock(); 
   } 
   else 
   { 
      Debug.WriteLine("Cannot lock or unlock because no object is currently being edited (selected)"); 
   } 
} 
 
void _automation_LockObject(object sender, AnnLockObjectEventArgs e) 
{ 
   Debug.WriteLine(string.Format("Lock it, sending password = {0}", "secret")); 
   e.Password = "secret"; 
} 
 
void _automation_UnlockObject(object sender, AnnLockObjectEventArgs e) 
{ 
   Debug.WriteLine(string.Format("Unlock it, sending password = {0}", "secret")); 
   e.Password = "secret"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Automation Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.