ISysLogSettings.IsActive

Syntax

IsActive: Boolean;

Description

The IsActive property determines whether syslog server connection is active.

Comments

Available values:

Example

Executing the example requires that the repository contains a form, the Button buttons named Button1 and Button2 on it, the CheckBox component named IsActive, the EditBox component named Server, the IntegerEdit component named Port, and two RadioButton components named UDP and TCP.

The example is a handler of the OnClick event for buttons.

// Read settings
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    SLSettings: ISysLogSettings;
Begin
    SLSettings := New SysLogSettings.Create;
    IsActive.Checked := SLSettings.IsActive;
    Server.Text := SLSettings.Server;
    Port.Value := SLSettings.Port;
    UDP.Checked := SLSettings.Protocol <> SysLogProtocol.TCP;
    TCP.Checked := SLSettings.Protocol = SysLogProtocol.TCP;
End Sub Button1OnClick;
    
// Save settings
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    SLSettings: ISysLogSettings;
Begin
    SLSettings := New SysLogSettings.Create;
    SLSettings.IsActive := IsActive.Checked;
    SLSettings.Server := Server.Text;
    SLSettings.Port := Port.Value;
    If UDP.Checked Then
        SLSettings.Protocol := SysLogProtocol.UDP;
    Else
        SLSettings.Protocol := SysLogProtocol.TCP;
    End If;
    // Settings will be saved to the location specified in SLSettings.Scope
    // Or to the location, from where they were read. If value was not set explicitly
    // If there are no settings saved, the SysLogSettingsScope.File value will be used 
    SLSettings.Save;
End Sub Button2OnClick;

By clicking the Button1 button activates the syslog server connection with the settings specified in the Server, Port, UDP and TCP components.

Clicking the Button2 button determines the IsActive state and settings are saved.

See also:

ISysLogSettings