⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_zdwh.pas

📁 用于家庭养殖的财务进出
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    exit;
  end;
  if edit4.Text='' then
  begin
    showmessage('表名不能为空!');
    exit;
  end;
  {if sqlstring='' then
    exit;  }
  if add then
  begin
    if Application.Messagebox('确定要新增一条信息!','注意!',MB_OKCANCEL+ mb_iconexclamation)=IDOK then
      addfield;
  end;
  if modify then
  begin
    if Application.Messagebox('确定要修改当前信息!','注意!',MB_OKCANCEL+ mb_iconexclamation)=IDOK then
      modfield;
  end;
  save:=true;
  readonly(true);
  ShwoGridInfo;
end;

procedure Tfrm_zd.ComboBox2Change(Sender: TObject);
var
  tempsql:string;
begin
  if add =true then
  begin
  if combobox2.Text='是' then
  begin
    edit11.Enabled:=false;
    if edit4.Text='' then
    begin
      showmessage('请先输入表名!');
      combobox2.ClearSelection;//.Text:=' ';
      exit;
    end;
    tempsql:='select max(ord) as maxord from field_info where table_name='+quotedstr(edit4.text);
    with dm.ADOQuery1 do
    begin
      close;
      sql.Clear;
      sql.Add(tempsql);
      open;
      edit11.Text:=inttostr(fieldbyname('maxord').AsInteger+1);
    end;
  end;
  end;
end;

procedure Tfrm_zd.B_EXITClick(Sender: TObject);
begin
  if save=false then
  begin
    if Application.Messagebox('你还未保存信息,确定要退出!','注意!',MB_OKCANCEL+ mb_iconexclamation)=IDOK then
      close;
  end
  else
    close;
end;

procedure Tfrm_zd.B_MODClick(Sender: TObject);
var
  sqlstring:string;
begin
  if Application.Messagebox('确定要修改当前信息!','注意!',MB_OKCANCEL+ mb_iconexclamation)=IDOK then
  begin
    readonly(false);
    add:=false;
    modify:=true;
    save:=false;
  end;
end;

procedure Tfrm_zd.B_CANCELClick(Sender: TObject);
begin
  //sqlstring:='';
end;

procedure Tfrm_zd.CKB_MaintainTableClickCheck(Sender: TObject);
var
  sqlstr:string;
  i:integer;
begin
  colwidth:=55;
  label1.Caption:='当前操作的数据表:';
  if CKB_MaintainTable.Checked[CKB_MaintainTable.ItemIndex] then
  begin
    label1.Caption:=label1.Caption+CKB_MaintainTable.Items.GetText;
    gentable_name:=maintaintablelistL[CKB_MaintainTable.ItemIndex];
  end;
  sqlstr:='select id,table_name,lab_name,field,'+
          'bx_info,cx_field ,is_browse ,'+
         'x ,y ,ord ,notnull,'+  {no as 排序值,}
          'type ,yn ,page ,compx ,compy '+
          ' from field_info where table_name='+quotedstr(gentable_name);

  with dm.ADOQuery7 do
  begin
    close;
    sql.Clear;
    sql.Add(sqlstr);
    open;
    for i:=0 to 15 do
    begin
    dbgrid1.Columns[i].Width:=colwidth;
    end;
  end;
    //=============================
    dbgrid1.Columns[0].Title.caption:='id';
    dbgrid1.Columns[1].Title.caption:='表名';
    dbgrid1.Columns[2].Title.caption:='字段中文名';
    dbgrid1.Columns[3].Title.caption:='字段英文名';
    dbgrid1.Columns[4].Title.caption:='是否有备选信息';
    dbgrid1.Columns[5].Title.caption:='是否为查询条件';
    dbgrid1.Columns[6].Title.caption:='是否为从属信息字段';
    dbgrid1.Columns[7].Title.caption:='标签控件上坐标';
    dbgrid1.Columns[8].Title.caption:='标签控件左坐标';
    dbgrid1.Columns[9].Title.caption:='排序值';
    dbgrid1.Columns[10].Title.caption:='是否必填';
    dbgrid1.Columns[11].Title.caption:='字段类型';
    dbgrid1.Columns[12].Title.caption:='是否显示';
    dbgrid1.Columns[13].Title.caption:='页面';
    dbgrid1.Columns[14].Title.caption:='填值控件上坐标';
    dbgrid1.Columns[15].Title.caption:='填值控件左坐标';
  //=============================
end;

procedure Tfrm_zd.RadioGroup1Click(Sender: TObject);
var
  sqlstr:string;
  i:integer;
begin
  colwidth:=55;
  label1.Caption:='当前操作的数据表:';
  label1.Caption:=label1.Caption+radiogroup1.Items[radiogroup1.itemindex];
  gentable_name:=maintaintablelistL[radiogroup1.itemindex];
  ShwoGridInfo;
end;

procedure Tfrm_zd.ShwoGridInfo;
var
  sqlstr:string;
  i:integer;
begin
  sqlstr:='select id,table_name,lab_name,field,'+
          'bx_info,cx_field ,is_browse ,'+
         'x ,y ,ord ,notnull,'+  {no as 排序值,}
          'type ,yn ,page ,compx ,compy '+
          ' from field_info where table_name='+quotedstr(gentable_name);

  with dm.ADOQuery7 do
  begin
    close;
    sql.Clear;
    sql.Add(sqlstr);
    open;
    for i:=0 to 15 do
    begin
    dbgrid1.Columns[i].Width:=colwidth;
    end;
  end;
    //=============================
    dbgrid1.Columns[0].Title.caption:='id';
    dbgrid1.Columns[1].Title.caption:='表名';
    dbgrid1.Columns[2].Title.caption:='字段中文名';
    dbgrid1.Columns[3].Title.caption:='字段英文名';
    dbgrid1.Columns[4].Title.caption:='是否有备选信息';
    dbgrid1.Columns[5].Title.caption:='是否为查询条件';
    dbgrid1.Columns[6].Title.caption:='是否为从属信息字段';
    dbgrid1.Columns[7].Title.caption:='标签控件上坐标';
    dbgrid1.Columns[8].Title.caption:='标签控件左坐标';
    dbgrid1.Columns[9].Title.caption:='排序值';
    dbgrid1.Columns[10].Title.caption:='是否必填';
    dbgrid1.Columns[11].Title.caption:='字段类型';
    dbgrid1.Columns[12].Title.caption:='是否显示';
    dbgrid1.Columns[13].Title.caption:='页面';
    dbgrid1.Columns[14].Title.caption:='填值控件上坐标';
    dbgrid1.Columns[15].Title.caption:='填值控件左坐标';
  //=============================
end;

//StrIn:需判断的字符串
{-------------------------------------------------------------------------
函数名:IsNumeric()
作者:  yangz
日期: 2003.11.27
输入: StrIn:String
功能描述:判断输入的数据是否是数字型的
--------------------------------------------------------------------------}
Function Tfrm_zd.IsNumeric(StrIn:String):Boolean;
var
  i:integer;
  temp : string[8];
  s: boolean;
  MyStr:String;
begin
  s := True;
  Temp := copy(StrIn,1,1);
  if (temp='+') or (temp='-') then
     MyStr := copy(StrIn,2,length(StrIn)-1)
  else
     MyStr := Strin;
  if length(MyStr) > 0 then
      for i:= 1 to length(MyStr) do
      begin
      temp := copy(MyStr,i,1);
      if (temp < '0') or (temp > '9') then
          begin
          s := false;
          break;
          end;
      end
  else
      s := False;
  IsNumeric := s;
end;
procedure Tfrm_zd.Edit5KeyPress(Sender: TObject; var Key: Char);
var
  p:integer;
  tp:Tpoint;
begin
  if key in['0'..'9','+','-','.'] then
    begin
       if key in['+','-'] then
//************判断是否为0~9以及是否为+,-号**************
         begin
           p:=pos('+',edit5.Text)+pos('-',edit5.Text);
           if p>0 then key:=#0
           else
             begin
               getcaretpos(tp);
               if tp.X>1 then key:=#0;
             end;
         end
       else
//*************判断是否为小数点****************
          if key='.' then
            begin
              p:=pos('.',edit5.Text);
              if p>0 then key:=#0;

            end;
    end
   else if key>#31 then
     key:=#0;
end;

procedure Tfrm_zd.Edit12KeyPress(Sender: TObject; var Key: Char);
var
  p:integer;
  tp:Tpoint;
begin
  if key in['0'..'9','+','-','.'] then
    begin
       if key in['+','-'] then
//************判断是否为0~9以及是否为+,-号**************
         begin
           p:=pos('+',edit12.Text)+pos('-',edit12.Text);
           if p>0 then key:=#0
           else
             begin
               getcaretpos(tp);
               if tp.X>1 then key:=#0;
             end;
         end
       else
//*************判断是否为小数点****************
          if key='.' then
            begin
              p:=pos('.',edit12.Text);
              if p>0 then key:=#0;

            end;
    end
   else if key>#31 then
     key:=#0;
end;
procedure Tfrm_zd.Edit13KeyPress(Sender: TObject; var Key: Char);
var
  p:integer;
  tp:Tpoint;
begin
  if key in['0'..'9','+','-','.'] then
    begin
       if key in['+','-'] then
//************判断是否为0~9以及是否为+,-号**************
         begin
           p:=pos('+',edit13.Text)+pos('-',edit13.Text);
           if p>0 then key:=#0
           else
             begin
               getcaretpos(tp);
               if tp.X>1 then key:=#0;
             end;
         end
       else
//*************判断是否为小数点****************
          if key='.' then
            begin
              p:=pos('.',edit13.Text);
              if p>0 then key:=#0;

            end;
    end
   else if key>#31 then
     key:=#0;
end;

procedure Tfrm_zd.Edit14KeyPress(Sender: TObject; var Key: Char);
var
  p:integer;
  tp:Tpoint;
begin
  if key in['0'..'9','+','-','.'] then
    begin
       if key in['+','-'] then
//************判断是否为0~9以及是否为+,-号**************
         begin
           p:=pos('+',edit14.Text)+pos('-',edit14.Text);
           if p>0 then key:=#0
           else
             begin
               getcaretpos(tp);
               if tp.X>1 then key:=#0;
             end;
         end
       else
//*************判断是否为小数点****************
          if key='.' then
            begin
              p:=pos('.',edit14.Text);
              if p>0 then key:=#0;

            end;
    end
   else if key>#31 then
     key:=#0;
end;

procedure Tfrm_zd.Edit15KeyPress(Sender: TObject; var Key: Char);
var
  p:integer;
  tp:Tpoint;
begin
  if key in['0'..'9','+','-','.'] then
    begin
       if key in['+','-'] then
//************判断是否为0~9以及是否为+,-号**************
         begin
           p:=pos('+',edit15.Text)+pos('-',edit15.Text);
           if p>0 then key:=#0
           else
             begin
               getcaretpos(tp);
               if tp.X>1 then key:=#0;
             end;
         end
       else
//*************判断是否为小数点****************
          if key='.' then
            begin
              p:=pos('.',edit15.Text);
              if p>0 then key:=#0;

            end;
    end
   else if key>#31 then
     key:=#0;
end;

procedure Tfrm_zd.Edit11KeyPress(Sender: TObject; var Key: Char);
var
  p:integer;
  tp:Tpoint;
begin
  if key in['0'..'9','+','-','.'] then
    begin
       if key in['+','-'] then
//************判断是否为0~9以及是否为+,-号**************
         begin
           p:=pos('+',edit11.Text)+pos('-',edit11.Text);
           if p>0 then key:=#0
           else
             begin
               getcaretpos(tp);
               if tp.X>1 then key:=#0;
             end;
         end
       else
//*************判断是否为小数点****************
          if key='.' then
            begin
              p:=pos('.',edit11.Text);
              if p>0 then key:=#0;

            end;
    end
   else if key>#31 then
     key:=#0;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -