HasDefaultElement : Boolean;
HasDefaultElement() : boolean;
The HasDefaultElement property returns element installed by default.
Executing the example requires a button named Button1, a tree with the repository elements named MetabaseTreeCombo1 and a label named Label1. Add links to the Metabase and Rds system asseblies:
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Obj: Imetabaseobject;
Dict: IRdsDictionary;
Begin
If MetabaseTreeCombo1.SelectedObjects.Count > 0 Then
obj := MetabaseTreeCombo1.SelectedObjects.Item(0).Bind;
Dict := obj As IRdsDictionary;
If Dict.HasDefaultElement Then //Check whether there is a default element.
Label1.Text := Dict.DefaultElementKey.ToString; //If it is set, then display its key.
Else Label1.Text := "There is no default element"; //If it is not set, then display the message "There is no default element".
End If;
End If;
End Sub Button1OnClick;
After executing the example, clicking the button in the Label1 label displays the element key by default or the There Is no Default Element message.
The requirements and result of the Fore.NET example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Obj: Imetabaseobject;
Dict: IRdsDictionary;
Begin
If MetabaseTreeComboNet1.SelectedObjects.Count > 0 Then
obj := MetabaseTreeComboNet1.SelectedObjects.Item[0].Bind();
Dict := obj As IRdsDictionary;
If Dict.HasDefaultElement() Then //Check whether there is default element.
Label1.Text := Dict.DefaultElementKey.ToString(); //If it is set, then display its key.
Else Label1.Text := "There is no default element"; //If it is not set, then display the message "There is no default element".
End If;
End If;
End Sub;
See also: