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

📄 common.pas

📁 电子元件管理软件
💻 PAS
字号:
unit common;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, StdCtrls, Grids, DBGrids, ExtCtrls, shellapi, data;
type
  tc_select = array of integer;

procedure initcombobox(c_object: TComboBox; var dc_object: tc_select; sql_str, id, value: string);
procedure selectcombox(c_object: tcombobox);
procedure unselectcombox(c_object: tcombobox; val: integer);

implementation



procedure initcombobox(c_object: TComboBox; var dc_object: tc_select; sql_str, id, value: string);
var
  tempi: integer;
begin
  with d do
    begin
      qtemp.close;
      qtemp.sql.clear;
      qtemp.sql.add(sql_str);
      qtemp.open;
      SetLength(dc_object, qtemp.RecordCount+1);
      qtemp.first;
      c_object.Items.Clear;
      dc_object[0] := 0;
      c_object.items.add('δ֪');
      tempi := 1;
      while not qtemp.eof do
        begin
          dc_object[tempi] := qtemp.fieldbyname(id).asinteger;
          c_object.items.add(qtemp.fieldbyname(value).asstring);
          qtemp.next;
          tempi := tempi + 1;
        end;
      qtemp.close;
    end;
end;

procedure selectcombox(c_object: tcombobox);
begin
  c_object.Tag := c_object.itemindex;
end;

procedure unselectcombox(c_object: tcombobox; val: integer);
begin
  c_object.ItemIndex := val;
end;

end.

⌨️ 快捷键说明

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