Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi E2003未声明的标识符:';表格1';-不知从哪里冒出来的_Delphi - Fatal编程技术网

Delphi E2003未声明的标识符:';表格1';-不知从哪里冒出来的

Delphi E2003未声明的标识符:';表格1';-不知从哪里冒出来的,delphi,Delphi,很长一段时间以来,我第一次在VM上涉猎Delphi,目前正在导入JSON。然而,突然之间(毫无疑问,我已经删除或破坏了一些东西),我无法编译这个项目 每次尝试时,我都会收到消息E003未声明的标识符:“Form1”,编辑器会捕捉到程序文件Project1,位于Application.CreateForm(TForm1,Form1)行 我已经附上了我的unit1.pas,这是表单所在的位置,以及看似相关的其他文件。请帮忙!我做了什么/删除了什么 unit Unit1; interface us

很长一段时间以来,我第一次在VM上涉猎Delphi,目前正在导入JSON。然而,突然之间(毫无疑问,我已经删除或破坏了一些东西),我无法编译这个项目

每次尝试时,我都会收到消息E003未声明的标识符:“Form1”,编辑器会捕捉到程序文件Project1,位于
Application.CreateForm(TForm1,Form1)

我已经附上了我的
unit1.pas
,这是表单所在的位置,以及看似相关的其他文件。请帮忙!我做了什么/删除了什么

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Xml.xmldom, Xml.XMLIntf,
  Xml.XMLDoc, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, IdSSLOpenSSL,
  IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, inifiles,
  Vcl.ExtCtrls, Vcl.ComCtrls;

const
  GstrAPIKey = 'removed this :)';

type
  TForm1 = class(TForm)
    Button1: TButton;
    XMLDocument1: TXMLDocument;
    Memo1: TMemo;
    IdHTTP1: TIdHTTP;
    IdSSL: TIdSSLIOHandlerSocketOpenSSL;
    rgrp_Home: TRadioGroup;
    cbx_Report: TComboBox;
    cbx_Charts: TComboBox;
    sb_Main: TStatusBar;
    dt_From: TDateTimePicker;
    dt_To: TDateTimePicker;
    Edit1: TEdit;
    lbl_DF: TLabel;
    Label1: TLabel;
    edt_Search: TEdit;
    Label2: TLabel;
    Button4: TButton;
    Button2: TButton;
    PageControl1: TPageControl;
    Reports: TTabSheet;
    Charts: TTabSheet;
    Label3: TLabel;
    Label4: TLabel;
    Memo2: TMemo;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure rgrp_HomeClick(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure cbx_ReportChange(Sender: TObject);
    procedure pnl_ReportsClick(Sender: TObject);
  private

    { Private declarations }
    procedure SetJSON(const Value : string);
    function GetJSON : string;
  public
          shortdateformat: string;
    { Public declarations }
    property JSON: string read GetJSON write SetJSON;

  end;

var
  strCommID : string;
  GstrPath,
  GstrCommID,
  GstrURL : string;

implementation

type
    TCareNote = (
                  CareNoteID  = 1,
                  CareNoteExtID = 2,
                  ADLName = 3,
                  FlagsText = 4,
                  Note = 5,
                  AnswerType = 6,
                  Fragment = 7,
                  RemedialText = 8,
                  Details = 9,
                  ServiceUserID = 10,
                  ServiceUser = 11,
                  ServiceUserLastName = 12,
                  ServiceUserForenames = 13,
                  ServiceUserDOB = 14,
                  ServiceUserLocation = 15,
                  WorkerID = 16,
                  Worker = 17,
                  VoidedByWorker = 18,
                  _supercedestack = 19,
                  SupercededbyWorker = 20,
                  WorkerLastName = 21,
                  DisplayonShiftHO = 22,
                  WorkerInitials = 23,
                  SliderData = 24,
                  SliderDate2 = 25,
                  SliderIcons = 26,
                  DateDone = 27,
                  DateDoneSU = 28,
                  Duration = 29,
                  DurationInt = 30,
                  ActionIconID = 31,
                  mraCareOrder = 32,
                  WasPlanned = 33,
                  qrVerified = 34,
                  qrData = 35,
                  nfcVerified = 36,
                  inVerified = 37
                );





{$R *.dfm}

function TForm1.GetJSON : string;
begin
  Result := Memo1.Lines.Text;
end;

procedure TForm1.SetJSON(const Value: string);
begin
  Memo1.Lines.Text := Value;
end;

{*********************************************}
procedure TForm1.Button1Click(Sender: TObject);
{*********************************************}
var
  s : tmemorystream;
begin
  idhttp1.HandleRedirects := TRUE;
  s := tmemorystream.Create;
  idhttp1.ReadTimeout := 30000;
  idhttp1.IOHandler := idssl;
  IdSSL.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
  IdSSL.SSLOptions.Mode := sslmUnassigned;
  idhttp1.Get(GstrURL,S);
  s.Position := 0;
  memo1.Lines.loadfromstream(s);
end;

{*********************************************}
procedure TForm1.Button4Click(Sender: TObject);


{*********************************************}
var
  IniFile : TIniFile;
  strURL : string;
  strRep : string;
  strDateFrom,
  strDateTo : string;
begin
  try
      IniFile := TIniFile.Create(GstrPath+'\config.ini');
      GstrURL := IniFile.ReadString('URL','path','Error');
      GstrURL := GstrURL+GstrAPIKey;
      GstrURL := GstrURL+'/ReportsAndChartsApi/Get/';
      case cbx_Report.ItemIndex of
        -1  :  ;
        0   : begin
                  strRep := 'CareNotesReport';
              end;
        1   : begin
                  strRep := 'AccidentsReport';
              end;
        2   : begin
                  strRep := 'IncidentsReport';
              end;
        3   : begin
                  strRep := 'FallsReport';

              end;
        4   : begin
                  strRep := 'InfectionsReport';
              end;
        5   : begin
                  strRep := 'WoundSummaryReport';
              end;
        end;

      //Dates to and from for the report...
      strDateFrom := FormatDateTime('yyyy-mm-dd',dt_From.Date);
      GstrURL := GstrURL + strRep +'?DateFrom='+strDateFrom;

      strDateTo := FormatDateTime('yyyy-mm-dd',dt_To.Date);
      GstrURL := GstrURL +'&DateTo='+strDateTo;

      if (Length(edt_Search.Text) > 0) and (cbx_Report.Itemindex <> 3) then
      begin
            GstrURL := GstrURL + '&SearchText='+edt_Search.Text;
      end;

      //Community IDs
      GstrURL := GstrURL + '&CommunityID='+GstrCommID;

      //if there is anything in the search text box...

      //showmessage(strurl);
  finally

  end;
  //edt_URL.Text := IniFile.ReadString('URL','Path')+DateToStr(dt_From.DateTime)+
end;

{*************************************************}
procedure TForm1.cbx_ReportChange(Sender: TObject);
{*************************************************}
begin
if (cbx_Report.ItemIndex = 3) then
        edt_Search.ReadOnly := TRUE
else
        edt_Search.ReadOnly := FALSE;
end;

{*******************************************}
procedure TForm1.FormCreate(Sender: TObject);
{*******************************************}
begin
  //find the path of the executable to make sure the right config file is used
  GstrPath := ExtractFilePath(Application.Exename);
end;

procedure TForm1.pnl_ReportsClick(Sender: TObject);
begin

end;

{***********************************************}
procedure TForm1.rgrp_HomeClick(Sender: TObject);
{***********************************************}
var
  Inifile : TIniFile;
  strChoice :string;
begin
    try
      Inifile := TIniFile.Create(GstrPath+'\config.ini'); //create the inifile link
      strChoice := rgrp_Home.Items[rgrp_Home.ItemIndex];
      if Inifile.SectionExists('Community') then
        if IniFile.ValueExists('Community',strChoice) then
        begin
            GstrCommID := IniFile.ReadString('Community',strChoice,'');

            sb_Main.Panels[0].Text := 'Current Home: '+strChoice;
            sb_Main.Panels[1].Text := 'Comm ID: '+ GstrCommID;
            IniFile.Destroy;
        end;
    finally
      if GstrCommID = '' then MessageDLG(strChoice+' is not yet on PCS',mtInformation,[mbOK],0);

    end;

end;

end.`



object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 669
  ClientWidth = 508
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poDesigned
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object lbl_DF: TLabel
    Left = 130
    Top = 119
    Width = 54
    Height = 13
    Caption = 'Date From:'
  end
  object Label1: TLabel
    Left = 233
    Top = 119
    Width = 42
    Height = 13
    Caption = 'Date To:'
  end
  object Label2: TLabel
    Left = 336
    Top = 119
    Width = 58
    Height = 13
    Caption = 'Search Text'
  end
  object Button1: TButton
    Left = 185
    Top = 165
    Width = 145
    Height = 49
    Caption = 'Fetch Information'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Memo1: TMemo
    Left = 19
    Top = 247
    Width = 481
    Height = 132
    TabOrder = 1
  end
  object rgrp_Home: TRadioGroup
    Left = 8
    Top = 8
    Width = 105
    Height = 177
    Caption = 'Homes'
    Items.Strings = (
      'Croston'
      'Hall'
      'Magnolia'
      'Manor'
      'Croft'
      'Lodge'
      'Hollow')
    TabOrder = 2
    OnClick = rgrp_HomeClick
  end
  object sb_Main: TStatusBar
    Left = 0
    Top = 650
    Width = 508
    Height = 19
    Panels = <
      item
        Text = 'Current Home:'
        Width = 200
      end
      item
        Text = 'Comm ID:'
        Width = 400
      end
      item
        Width = 50
      end>
  end
  object dt_From: TDateTimePicker
    Left = 130
    Top = 138
    Width = 97
    Height = 21
    Date = 43744.000000000000000000
    Time = 0.867717511573573600
    TabOrder = 4
  end
  object dt_To: TDateTimePicker
    Left = 233
    Top = 138
    Width = 97
    Height = 21
    Date = 43744.000000000000000000
    Time = 0.867717511573573600
    TabOrder = 5
  end
  object Edit1: TEdit
    Left = 19
    Top = 220
    Width = 481
    Height = 21
    TabOrder = 6
  end
  object edt_Search: TEdit
    Left = 336
    Top = 138
    Width = 95
    Height = 21
    TabOrder = 7
  end
  object Button4: TButton
    Left = 398
    Top = 82
    Width = 75
    Height = 25
    Caption = 'Create URL'
    TabOrder = 8
    OnClick = Button4Click
  end
  object PageControl1: TPageControl
    Left = 130
    Top = 51
    Width = 255
    Height = 62
    ActivePage = Reports
    TabOrder = 9
    object Reports: TTabSheet
      Caption = 'Reports'
      object Label3: TLabel
        Left = 20
        Top = 12
        Width = 72
        Height = 13
        Caption = 'Choose Report'
      end
      object cbx_Report: TComboBox
        Left = 99
        Top = 9
        Width = 145
        Height = 21
        Style = csDropDownList
        TabOrder = 0
        OnChange = cbx_ReportChange
        Items.Strings = (
          'Care Notes'
          'Accidents'
          'Incidents'
          'Falls'
          'Infections'
          'Wounds')
      end
    end
    object Charts: TTabSheet
      Caption = 'Charts'
      ImageIndex = 1
      ExplicitLeft = 0
      ExplicitTop = 0
      ExplicitWidth = 0
      ExplicitHeight = 0
      object Label4: TLabel
        Tag = 10
        Left = 20
        Top = 13
        Width = 66
        Height = 13
        Caption = 'Choose Chart'
      end
      object cbx_Charts: TComboBox
        Left = 99
        Top = 9
        Width = 145
        Height = 21
        Style = csDropDownList
        TabOrder = 0
        Items.Strings = (
          'Bowel Movements'
          'Fluids'
          'Hygiene'
          'Bedrails Checks'
          'Mattress Check'
          'Repositioning'
          'Emotional Support')
      end
    end
  end
  object Button2: TButton
    Left = 164
    Top = 10
    Width = 75
    Height = 25
    Caption = 'Button2'
    TabOrder = 10
  end
  object Memo2: TMemo
    Left = 19
    Top = 432
    Width = 481
    Height = 193
    Lines.Strings = (
      'Memo2')
    TabOrder = 11
  end
  object Button3: TButton
    Left = 216
    Top = 401
    Width = 75
    Height = 25
    Caption = 'Button3'
    TabOrder = 12
  end
  object XMLDocument1: TXMLDocument
    Left = 896
    Top = 8
  end
  object IdHTTP1: TIdHTTP
    AllowCookies = True
    HandleRedirects = True
    ProxyParams.BasicAuthentication = False
    ProxyParams.ProxyPort = 0
    Request.ContentLength = -1
    Request.ContentRangeEnd = -1
    Request.ContentRangeStart = -1
    Request.ContentRangeInstanceLength = -1
    Request.Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
    Request.BasicAuthentication = False
    Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
    Request.Ranges.Units = 'bytes'
    Request.Ranges = <>
    HTTPOptions = [hoForceEncodeParams]
    Left = 944
    Top = 8
  end
  object IdSSL: TIdSSLIOHandlerSocketOpenSSL
    MaxLineAction = maException
    Port = 0
    DefaultPort = 0
    SSLOptions.Mode = sslmUnassigned
    SSLOptions.VerifyMode = []
    SSLOptions.VerifyDepth = 0
    Left = 984
    Top = 8
  end
end`
单元1;
接口
使用
Winapi.Windows、Winapi.Messages、System.SysUtils、System.Variants、System.Classes、Vcl.Graphics、,
控件、窗体、对话框、StdCtrls、Xml.xmldom、Xml.XMLIntf、,
Xml.XMLDoc、IdBaseComponent、IdComponent、IdTCPConnection、IdTCPClient、IdHTTP、IdSSLOpenSSL、,
IDOIHandler、IDOIHandlerSocket、IDOIHandlerStack、IdSSL、inifiles、,
Vcl.ExtCtrls,Vcl.ComCtrls;
常数
GstrAPIKey='删除此:)';
类型
TForm1=类(TForm)
按钮1:t按钮;
XMLDocument1:TXMLDocument;
备忘录1:TMemo;
IdHTTP1:TIdHTTP;
IdSSL:TIdSSLIOHandlerSocketOpenSSL;
rgrp_主页:TRadioGroup;
cbx_报告:Tcombox;
cbx_图表:TComboBox;
sb_Main:TStatusBar;
dt_From:TDateTimePicker;
dt_To:TDateTimePicker;
编辑1:TEdit;
lbl_DF:TLabel;
标签1:TLabel;
edt_搜索:TEdit;
标签2:TLabel;
按钮4:t按钮;
按钮2:t按钮;
PageControl1:TPageControl;
报告:TTabSheet;
图表:TTabSheet;
标签3:TLabel;
Label4:TLabel;
备忘录2:TMemo;
按钮3:t按钮;
程序按钮1点击(发送方:ToObject);
程序rgrp_HomeClick(发送方:ToObject);
程序按钮4点击(发送方:ToObject);
过程表单创建(发送方:ToObject);
程序cbx_报告变更(发送人:TObject);
程序pnl_报告点击(发送人:TObject);
私有的
{私有声明}
过程SetJSON(常量值:字符串);
函数GetJSON:string;
公众的
shortdateformat:string;
{公开声明}
属性JSON:string read GetJSON write SetJSON;
结束;
变量
strCommID:字符串;
GstrPath,
GSTR委员会,
GstrURL:字符串;
实施
类型
丁烯二酸=(
CareNoteID=1,
CareNoteExtID=2,
ADLName=3,
FlagsText=4,
注=5,
回答类型=6,
碎片=7,
RemedialText=8,
详情=9,
ServiceUserID=10,
ServiceUser=11,
ServiceUserLastName=12,
ServiceUserForemanes=13,
ServiceUserDOB=14,
ServiceUserLocation=15,
WorkerID=16,
工人=17,
工人作废=18,
_替换堆栈=19,
替换的ByWorker=20,
WorkerLastName=21,
显示shiftho=22,
工作初始值=23,
滑块数据=24,
滑块日期2=25,
SliderIcons=26,
DateDone=27,
DateDoneSU=28,
持续时间=29,
持续时间=30,
ActionIconID=31,
mracoreorder=32,
已计划=33,
qr=34,
qrData=35,
NFC验证=36,
未验证=37
);
{$R*.dfm}
函数TForm1.GetJSON:string;
开始
结果:=Memo1.Lines.Text;
结束;
过程TForm1.SetJSON(常量值:字符串);
开始
Memo1.Lines.Text:=值;
结束;
{*********************************************}
程序TForm1.按钮1单击(发送方:TObject);
{*********************************************}
变量
s:tmemorystream;
开始
idhttp1.HandlerRedirects:=TRUE;
s:=tmemorystream.Create;
idhttp1.ReadTimeout:=30000;
idhttp1.IOHandler:=idssl;
IdSSL.SSLOptions.SSLVersions:=[sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2];
IdSSL.SSLOptions.Mode:=sslmUnassigned;
idhttp1.Get(GstrURL,S);
s、 位置:=0;
备忘录1.行。从流加载;
结束;
{*********************************************}
程序TForm1.按钮4点击(发送方:TObject);
{*********************************************}
变量
IniFile:TIniFile;
strURL:字符串;
strRep:字符串;
strDateFrom,
strDateTo:字符串;
开始
尝试
IniFile:=TIniFile.Create(GstrPath+'\config.ini');
GstrURL:=IniFile.ReadString('URL','path','Error');
GstrURL:=GstrURL+GstrAPIKey;
GstrURL:=GstrURL+'/reportsandschartsapi/Get/';
案例cbx_Report.ItemIndex of
-1  :  ;
0:开始
strRep:=“CareNotesReport”;
结束;
1:开始
strRep:=“意外报告”;
结束;
2:开始
strRep:=“意外事件报告”;
结束;
3:开始
strRep:='FallsReport';
结束;
4:开始
strRep:=“传染报告”;
结束;
5:开始
strRep:=“WoundSummaryReport”;
结束;
结束;
//报告的往返日期。。。
strDateFrom:=FormatDateTime('yyyy-mm-dd',dt_From.Date);
GstrURL:=GstrURL+strep+'?DateFrom='+strDateFrom;
标准日期:=格式日期时间('yyyy-mm-dd',截止日期);
GstrURL:=GstrURL+'&DateTo='+strDateTo;
如果(长度(edt_Search.Text)>0)和(cbx_Report.Itemindex 3),则
开始
GstrURL:=GstrURL+'&SearchText='+edt_Search.Text;
结束;
//社区ID
GstrURL:=GstrURL+'&CommunityID='1!'
var
  Form1: TForm1;  // <<--- Should be there, but is missing
  strCommID : string;
  GstrPath,
  GstrCommID,
  GstrURL : string;