11
uses gdk,gtk,fpgtk,fpgtkext,classes,sysutils,eventlog;
13
{ ---------------------------------------------------------------------
15
---------------------------------------------------------------------}
19
TMainForm = Class(TFPGtkWindow)
20
FEventLog : TEventLog;
21
RGFrame : TFPgtkFrame;
26
RGMsgType : TFPgtkRadioButtonGroup;
29
Procedure BSendClicked(Sender : TFPgtkObject; Data : Pointer);
32
Destructor Destroy; override;
33
Procedure CreateWindow;
38
SCaption = 'Free Pascal Event Log Demo';
39
SEventlogDemo = 'TestEventlogClass';
40
SMessage = 'Message text:';
41
SMsgType = 'Message type:';
42
SSend = 'Send message';
43
SInformation = 'Information';
48
{ ---------------------------------------------------------------------
50
---------------------------------------------------------------------}
52
Constructor TMainForm.Create;
55
Inherited create (gtk_window_dialog);
59
Procedure TMainForm.CreateWindow;
61
Procedure AddRG(C : String);
64
RB : TFPgtkRadioButton;
67
RB:= TFPgtkRadioButton.CreateWithLabel(RGmsgType,C);
68
RGBox.Packstart(RB,False,False,2);
69
rb.TheLabel.Justify:=GTK_JUSTIFY_LEFT;
76
BSend:=TFPGtkButton.CreateWithlabel(SSend);
77
BSend.ConnectCLicked(@BSendClicked,Nil);
78
RGFrame:=TFpgtkFrame.Create;
79
RGFrame.Text:=SMsgType;
80
RGBox:=TFPgtkVBox.Create;
82
S:=TstringList.Create;
91
RGMsgType:=RadioButtonGroupCreateFromStrings(S,Nil);
92
RGMsgType.PackInBox(RGBox,True,False,False,2);
96
FLMsg:=TfpGtkLabel.Create(SMessage);
97
FMsg:=TfpGtkEntry.Create;
98
FHBox:=TFPgtkHbox.Create;
99
FHBox.PackStart(FLMsg,False,False,2);
100
FHBox.PackStart(FMsg,True,True,2);
102
FVBox:=TFPgtkVBox.Create;
103
FVBox.Homogeneous:=False;
104
FVBox.PackStart(FHBox,False,False,2);
105
FVBox.PackStart(RGFrame,False,False,2);
106
FVBox.PackStart(BSend,true,false,2);
109
FEventLog:=TEventlog.Create(Nil);
110
FEventLog.Identification:=SEventLogDemo;
111
FEventLog.RegisterMessagefile('');
112
FEventLog.Active:=True;
115
Destructor TMainForm.Destroy;
118
FEventLog.Active:=False;
123
{ ---------------------------------------------------------------------
125
---------------------------------------------------------------------}
127
Procedure TMainForm.BSendClicked(Sender : TFPgtkObject; Data : Pointer);
134
Procedure TMainForm.SendEvent;
140
Case RGMsgType.ActiveButtonIndex of
146
FEventLog.log(E,FMsg.Text);
149
{ ---------------------------------------------------------------------
151
---------------------------------------------------------------------}
154
application := TFPgtkApplication.Create;
155
application.MainWindow := TMainForm.Create;
b'\\ No newline at end of file'