FormRemoteExplor.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. unit FormRemoteExplor;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
  6. FrameExpRemoto, strutils, FormRemoteEditor, MisUtils;
  7. type
  8. { TfrmRemoteExplor }
  9. TfrmRemoteExplor = class(TForm)
  10. procedure explorDblClickArch;
  11. procedure explorEnter(Sender: TObject);
  12. procedure FormActivate(Sender: TObject);
  13. procedure FormCreate(Sender: TObject);
  14. procedure FormDestroy(Sender: TObject);
  15. procedure FormShow(Sender: TObject);
  16. private
  17. explor: TfraExpRemoto;
  18. actualizar: boolean;
  19. end;
  20. var
  21. frmRemoteExplor: TfrmRemoteExplor;
  22. implementation
  23. {$R *.lfm}
  24. { TfrmRemoteExplor }
  25. procedure TfrmRemoteExplor.FormCreate(Sender: TObject);
  26. begin
  27. explor:= TfraExpRemoto.Create(self);
  28. explor.Parent := self;
  29. explor.Align:=alClient;
  30. explor.OnDblClickArch:=@explorDblClickArch;
  31. // explor.OnEnter:=@explorEnter;
  32. end;
  33. procedure TfrmRemoteExplor.FormDestroy(Sender: TObject);
  34. begin
  35. explor.Destroy;
  36. end;
  37. procedure TfrmRemoteExplor.FormShow(Sender: TObject);
  38. begin
  39. Caption:= 'Remote Explorer';
  40. actualizar := true;
  41. end;
  42. procedure TfrmRemoteExplor.explorEnter(Sender: TObject);
  43. begin
  44. msgbox('Enter');
  45. end;
  46. procedure TfrmRemoteExplor.explorDblClickArch;
  47. var
  48. it: TListItem;
  49. begin
  50. it := explor.ItemSeleccionado;
  51. if it = nil then exit;
  52. if AnsiEndsText('.txt',it.Caption)
  53. or AnsiEndsText('.sql',it.Caption)
  54. or AnsiEndsText('.sh',it.Caption)
  55. or AnsiEndsText('.py',it.Caption)
  56. or AnsiEndsText('.pas',it.Caption)
  57. then begin
  58. //tipos conocidos, se editan
  59. frmRemoteEditor.AbrirRemoto(it.Caption);
  60. end;
  61. end;
  62. procedure TfrmRemoteExplor.FormActivate(Sender: TObject);
  63. begin
  64. if actualizar then begin
  65. explor.Actualizar; //lee archivos
  66. actualizar := false;
  67. end;
  68. end;
  69. end.