114 lines
2.2 KiB
ObjectPascal
114 lines
2.2 KiB
ObjectPascal
unit VisualizzaEventiForm;
|
|
|
|
{$mode ObjFPC}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
{$ifdef windows}
|
|
windows,
|
|
{$endif}
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, EditBtn, StdCtrls,
|
|
Spin, ComCtrls, LazNumEdit, ListFilterEdit;
|
|
|
|
type
|
|
|
|
{ TForm2 }
|
|
|
|
TForm2 = class(TForm)
|
|
ListBox1: TListBox;
|
|
ListFilterEdit1: TListFilterEdit;
|
|
SpinEdit1: TSpinEdit;
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure SpinEdit1Change(Sender: TObject);
|
|
private
|
|
|
|
public
|
|
|
|
end;
|
|
|
|
var
|
|
Form2: TForm2;
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
{ TForm2 }
|
|
|
|
procedure TForm2.SpinEdit1Change(Sender: TObject);
|
|
var
|
|
nasastringlist:TStringList;
|
|
nasalinea:string;
|
|
RisorseStream:TResourceStream;
|
|
elementi:string;
|
|
orario:string;
|
|
caratteretab:string;
|
|
begin
|
|
|
|
ListBox1.Clear;
|
|
ListFilterEdit1.FilteredListbox:=nil;
|
|
ListFilterEdit1.Text:='';
|
|
try
|
|
RisorseStream:= TResourceStream.Create(HInstance,inttostr(SpinEdit1.Value)+'_NASA', RT_RCDATA);
|
|
nasastringlist:=TStringList.Create;
|
|
SetLength(nasalinea, RisorseStream.Size);
|
|
RisorseStream.Read(nasalinea[1], RisorseStream.Size);;
|
|
nasastringlist.AddDelimitedText(nasalinea, #10, True);
|
|
|
|
for elementi in nasastringlist do
|
|
begin
|
|
|
|
|
|
|
|
if elementi<>'' then
|
|
begin
|
|
|
|
{$ifdef windows}
|
|
caratteretab:=' ';
|
|
ListBox1.Font.Name := 'Courier New';
|
|
{$endif}
|
|
{$ifdef linux}
|
|
caratteretab:=#9;
|
|
|
|
{$endif}
|
|
{$ifdef darwin}
|
|
caratteretab:=' ';
|
|
ListBox1.Font.Name := 'Monaco';
|
|
ListBox1.Font.Size:=12;
|
|
{$endif}
|
|
|
|
|
|
ListBox1.Items.Add(copy(elementi, 1,2)+'/'+copy(elementi,5,2)+caratteretab+'CET '+copy(elementi, 9,5)+caratteretab+' '+copy(elementi, 16));
|
|
|
|
end;
|
|
|
|
end;
|
|
nasastringlist.Free;
|
|
ListFilterEdit1.FilteredListbox:=ListBox1;
|
|
except
|
|
on E:EResNotFound do
|
|
begin
|
|
ListBox1.Items.Add('Eventi non disponibili');
|
|
|
|
end;
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TForm2.FormShow(Sender: TObject);
|
|
begin
|
|
Form2.SpinEdit1Change(nil);
|
|
end;
|
|
|
|
procedure TForm2.FormCreate(Sender: TObject);
|
|
begin
|
|
{$ifdef darwin}
|
|
ListBox1.Style:=lbOwnerDrawFixed; //su mac non cambia il font senza questo
|
|
{$endif darwin}
|
|
end;
|
|
|
|
end.
|
|
|