unit U_SCPersonAA;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
  cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
  cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
  ExtCtrls, BtnEdit, cxDropDownEdit,StrUtils, cxPC, Buttons;

type
  TfrmSCPersonAA = class(TForm)
    ADOTemp: TADOQuery;
    ScrollBox1: TScrollBox;
    btn1: TSpeedButton;
    btn2: TSpeedButton;
    btn3: TSpeedButton;
    btn4: TSpeedButton;
    btn5: TSpeedButton;
    btn6: TSpeedButton;
    btn7: TSpeedButton;
    btn8: TSpeedButton;
    btn58: TSpeedButton;
    btn9: TSpeedButton;
    btn10: TSpeedButton;
    btn11: TSpeedButton;
    btn12: TSpeedButton;
    btn13: TSpeedButton;
    btn14: TSpeedButton;
    btn15: TSpeedButton;
    btn59: TSpeedButton;
    btn16: TSpeedButton;
    btn17: TSpeedButton;
    btn18: TSpeedButton;
    btn19: TSpeedButton;
    btn20: TSpeedButton;
    btn21: TSpeedButton;
    btn22: TSpeedButton;
    btn60: TSpeedButton;
    btn23: TSpeedButton;
    btn24: TSpeedButton;
    btn25: TSpeedButton;
    btn26: TSpeedButton;
    btn27: TSpeedButton;
    btn28: TSpeedButton;
    btn29: TSpeedButton;
    btn61: TSpeedButton;
    btn30: TSpeedButton;
    btn31: TSpeedButton;
    btn32: TSpeedButton;
    btn33: TSpeedButton;
    btn34: TSpeedButton;
    btn35: TSpeedButton;
    btn36: TSpeedButton;
    btn62: TSpeedButton;
    btn37: TSpeedButton;
    btn38: TSpeedButton;
    btn39: TSpeedButton;
    btn40: TSpeedButton;
    btn41: TSpeedButton;
    btn42: TSpeedButton;
    btn43: TSpeedButton;
    btn63: TSpeedButton;
    btn44: TSpeedButton;
    btn45: TSpeedButton;
    btn46: TSpeedButton;
    btn47: TSpeedButton;
    btn48: TSpeedButton;
    btn49: TSpeedButton;
    btn50: TSpeedButton;
    btn64: TSpeedButton;
    btn51: TSpeedButton;
    btn52: TSpeedButton;
    btn53: TSpeedButton;
    btn54: TSpeedButton;
    btn55: TSpeedButton;
    btn56: TSpeedButton;
    btn57: TSpeedButton;
    ClientDataSet1: TClientDataSet;
    procedure btn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    procedure InitPerson();

    { Private declarations }
  public
     FPersonName:String;
    { Public declarations }
  end;

var
  frmSCPersonAA: TfrmSCPersonAA;
  newh:hwnd;
implementation
uses
  U_DataLink,U_ZDYHelp,U_RTFun;

{$R *.dfm}



procedure TfrmSCPersonAA.btn1Click(Sender: TObject);
var
  i,j:Integer;
begin
  FPersonName:=btn1.Caption;
  for j:=0 to 63 do
  begin
    with ScrollBox1 do
    begin
      TSpeedButton(Controls[j]).Visible:=false;
      TSpeedButton(Controls[j]).Hint:='';
     { TSpeedButton(Controls[j]).Hint:=BB[j];
      if Length(BB[j])>4 then
      begin
        TSpeedButton(Controls[j]).Caption:=Copy(Trim(BB[j]),1,4)+#13+Copy(Trim(BB[j]),5,Length(BB[j])-4);
      end else
        TSpeedButton(Controls[j]).Caption:=BB[j];}
    end;
  end;

  ModalResult:=1;
end;
procedure TfrmSCPersonAA.InitPerson();
var
  BB:array[0..100] of string;
  i,j:Integer;
begin

  with ADOTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select ZDYName from KH_Zdy where Type=''SCPerson'' order by ZDYName ');
    Open;
  end;
  if ADOTemp.IsEmpty then
  begin
    Application.MessageBox('没有定义数据！','提示',0);
    Exit;
  end;
  SCreateCDS20(ADOTemp,ClientDataSet1);
  SInitCDSData20(ADOTemp,ClientDataSet1);
  with ClientDataSet1 do
  begin
    First;
    i:=0;
    while not Eof do
    begin
      BB[i]:=Trim(fieldbyname('ZDYName').AsString);
      i:=i+1;
      Next;
    end;
  end;
  i:=i-1;
  if i>63 then
  begin
    i:=63;
  end;
  for j:=0 to i do
  begin
    with ScrollBox1 do
    begin
      TSpeedButton(Controls[j]).Visible:=True;
      TSpeedButton(Controls[j]).Caption:=BB[j];
      TSpeedButton(Controls[j]).Hint:=BB[j];
     { TSpeedButton(Controls[j]).Hint:=BB[j];
      if Length(BB[j])>4 then
      begin
        TSpeedButton(Controls[j]).Caption:=Copy(Trim(BB[j]),1,4)+#13+Copy(Trim(BB[j]),5,Length(BB[j])-4);
      end else
        TSpeedButton(Controls[j]).Caption:=BB[j];}
    end;
  end;
end;
procedure TfrmSCPersonAA.FormShow(Sender: TObject);
begin
  InitPerson();
end;

end.
