Cancels an operation during certain "pre" events.

Usage

Set_Property(OLECtrlEntID, "OLE.Cancel", Boolean)

Values

0, 1, or 2

Default: 0

Remarks

The Cancel property is automatically set to 0 before the OnDragStart or BeforeUpdate events are fired. These events fire when a user starts and operation but before the operation is truly applied. If the operation is not desired, then setting this property to 1 during the event will abort the operation. Note that this only works if you qualify the aforementioned events synchronously.

Setting this to 1 during the OnDragStart event cancels the drag completely.

Settings this to 1 or 2 during the BeforeUpdate prevents the item's data from updating but leaves the item in edit mode. If you set this to 1, the item stays in edit mode with the cursor at the end of the text. If you set this to 2, the item stays in edit mode with all the text selected.

Example

OLE_TREE.OnDragStart: 

   // Get the list of items to be dragged 
   Items = Param1 
   Convert ',' to @FM in Items 
    
   // Don't allow users to drag if any of the items are of the "Group" class 
   Cancel = 0 
   Pos = 1 
   Flag = "" 
   Loop 
       Remove Item From Items At Pos Setting Flag 
   While Item NE "" AND Cancel EQ 0 
       Class = Get_Property(CtrlEntId, "OLE.ItemClass[":Item:"]") 
       Cancel = Class _EQC "Group" 
   Repeat 
    
   // Cancel if need be 
   Set_Property(CtrlEntId, "OLE.Cancel", Cancel) 
    
return

See Also

BeforeUpdate, DefCancelOnDragStart

  • No labels