pbCancelEdit - AbstractTreeView
Used in OnBeginLabelEdit and OnEndLabelEdit to cancel the editing of a treeview label
Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None
Syntax
Property Boolean pbCancelEdit
| Access Type | Syntax |
|---|---|
| Read Access: | Get pbCancelEdit to BooleanVariable |
| Write Access: | Set pbCancelEdit to BooleanVariable/Value |
Description
pbCancelEdit is obsolete as of DataFlex revision 15.0.
Events OnBeginLabelEdit, OnEndLabelEdit, OnItemChanging, OnItemExpanding, OnItemCollapsing, OnItemClick and OnItemDblClick now all have a bCancel parameter that can be used to cancel each of these events.
pbCancelEdit is used in OnBeginLabelEdit and OnEndLabelEdit to cancel the editing of a treeview label. Before either of these events are called, pbCancelEdit is always set False. If the developer sets this property to True, the edit will be cancelled.
Procedure OnBeginLabelEdit Handle hItem
handle hRoot
// if we are editing the root, don't allow and declare an error
Get RootItem to hRoot
If (hItem=hRoot) begin
set pbCancelEdit to True
Error DFERR_OPERATOR "Cannot change the root Label"
end
End_Procedure
Procedure OnEndLabelEdit Handle hItem String sNewLabel Boolean bWasCanceled
string sOriginalLabel
if not bWasCanceled begin
// get old value of the label
Get ItemLabel hItem to sOriginalLabel
// don't allow edit to be blank
If (sNewLabel="") Begin
set pbCancelEdit to True
Error DFERR_OPERATOR "Blank labels not allowed"
end
else If (sOriginalLabel=sNewLabel) begin
// if no change, complain
Error DFERR_OPERATOR "You did not change anything"
end
End
else begin
// This really isn't an error, but you get the idea
Error DFERR_OPERATOR "canceled by User"
end
End_Procedure
pbCancelEdit can also be set to False during OnItemChanging to cancel the changing of a TreeView item.
See Also
OnBeginLabelEdit | OnEndLabelEdit | TreeEditLabelsState | ItemLabel