frmabout.pp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {$mode objfpc}
  2. {$h+}
  3. unit frmabout;
  4. interface
  5. uses fpgtk,gtk,classes,sysutils;
  6. Type
  7. TAboutForm = Class (TFPGtkWindow)
  8. FAboutText : TFPGtkLabel;
  9. FSeparator : TFPGtkHSeparator;
  10. FVBox : TFPgtkVBox;
  11. FOK,
  12. FCancel : TFPGtkButton;
  13. FButtonBox: TFPgtkHBox;
  14. Constructor Create;
  15. Procedure CreateWindow;
  16. end;
  17. Implementation
  18. uses fpdemsg;
  19. Constructor TAboutForm.Create;
  20. begin
  21. Inherited Create(GTK_WINDOW_DIALOG);
  22. CreateWindow;
  23. end;
  24. Procedure TAboutForm.CreateWindow;
  25. begin
  26. FVBox:=TFPGtkVBox.Create;
  27. FVBox.Spacing:=4;
  28. FVBox.Border:=8;
  29. Add(FVBox);
  30. // About text
  31. FAboutText:=TFPgtkLabel.Create(SAboutText);
  32. // button area
  33. FOK:=TFpGtkButton.CreateWithLabel(SOK);
  34. FOK.ConnectClicked(@CloseWithResult,IntToPointer(drOK));
  35. FCancel:=TFPgtkButton.CreateWithLabel(SCancel);
  36. FCancel.ConnectCLicked(@CloseWithResult,IntToPointer(drCancel));
  37. FSeparator:=TFPgtkHSeparator.Create;
  38. FButtonBox:=TfpGtkHBox.Create;
  39. FButtonBox.Spacing:=4;
  40. FButtonBox.PackEnd(FOK,false,false,4);
  41. FButtonBox.PackEnd(FCancel,false,false,4);
  42. // Add to window
  43. FVBox.PackStart(FAboutText,True,True,0);
  44. FVBox.PackStart(FSeparator,False,False,4);
  45. FVBox.PackStart(FButtonBox,false,false,0);
  46. end;
  47. end.