1{$mode objfpc}
2{$h+}
3
4unit frmnewnode;
5
6interface
7
8uses fpgtk,gtk,classes,sysutils;
9
10Type
11  TNewNodeForm = Class (TFPGtkWindow)
12    FTable : TFPGtkTable;
13    FLENodeName : TFPGtkLabel;
14    FENodeName : TFPGtkEntry;
15    FSeparator : TFPGtkHSeparator;
16    FVBox : TFPgtkVBox;
17    FOK,
18    FCancel : TFPGtkButton;
19    FButtonBox: TFPgtkHBox;
20    Constructor Create;
21    Procedure CreateWindow;
22    Procedure OnShow(Sender : TFpGtkObject;Data : Pointer);
23  end;
24
25Implementation
26
27uses
28  fpdemsg;
29
30Constructor TNewNodeForm.Create;
31
32begin
33  Inherited Create(GTK_WINDOW_DIALOG);
34  CreateWindow;
35end;
36
37Procedure TNewNodeForm.CreateWindow;
38
39Var
40  OH,OV : TgtkAttachOPtions;
41
42begin
43  FVBox:=TFPGtkVBox.Create;
44  FVBox.Spacing:=4;
45  FVBox.Border:=8;
46  Add(FVBox);
47  // Table area
48  FTable:=TFPGtkTable.Create(1,1);
49  FLENodeName:=TFPGtkLabel.Create(SName);
50  FLENodeName.Justify:=GTK_JUSTIFY_RIGHT;
51  FENodeName:=TFPgtkEntry.Create;
52  FENodeName.GrabFocus;
53  OH:=GTK_EXPAND or GTK_FILL;
54  FTable.Attach(FLENodeName,0,1,0,1,0,GTK_FILL,4,4);
55  FTable.Attach(FENodeName,1,2,0,1,OH,0,4,4);
56  // button area
57  FOK:=TFpGtkButton.CreateWithLabel(SOK);
58  FOK.ConnectClicked(@CloseWithResult,IntToPointer(drOK));
59  FCancel:=TFPgtkButton.CreateWithLabel(SCancel);
60  FCancel.ConnectCLicked(@CloseWithResult,IntToPointer(drCancel));
61  FSeparator:=TFPgtkHSeparator.Create;
62  FButtonBox:=TfpGtkHBox.Create;
63  FButtonBox.Spacing:=4;
64  FButtonBox.PackEnd(FOK,false,false,4);
65  FButtonBox.PackEnd(FCancel,false,false,4);
66  // Add to window
67  FVBox.PackStart(FTable,False,False,0);
68  FVBox.PackStart(FSeparator,False,False,4);
69  FVBox.PackStart(FButtonBox,false,false,0);
70  // Some events;
71  ConnectShow(@OnShow,Nil);
72end;
73
74Procedure TNewNodeForm.OnShow(Sender : TFpgtkObject; Data : Pointer);
75
76begin
77  FocusedWidget(FENodeName);
78end;
79
80
81end.
82