479 lines
13 KiB
ObjectPascal
479 lines
13 KiB
ObjectPascal
|
|
unit U_frameCCQXList;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|||
|
|
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics,
|
|||
|
|
cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
|
|||
|
|
cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxNavigator,
|
|||
|
|
dxDateRanges, dxScrollbarAnnotations, Data.DB, cxDBData, cxCheckBox,
|
|||
|
|
cxTextEdit, dxBarBuiltInMenu, Vcl.Menus, cxGridCustomPopupMenu,
|
|||
|
|
cxGridPopupMenu, Datasnap.DBClient, Data.Win.ADODB, cxGridLevel,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
|
cxGridCustomView, cxGrid, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ToolWin,
|
|||
|
|
Vcl.ExtCtrls, dxSkinsCore, dxSkinsDefaultPainters, cxMemo, cxLabel, cxMaskEdit,
|
|||
|
|
cxDropDownEdit, cxButtonEdit, cxButtons;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TframeCCQXList = class(TFrame)
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Panel_ccqx: TPanel;
|
|||
|
|
LabelCCQX: TLabel;
|
|||
|
|
cxLabel113: TcxLabel;
|
|||
|
|
ccqx_speed: TcxTextEdit;
|
|||
|
|
ccqx_temperature1: TcxTextEdit;
|
|||
|
|
ccqx_temperature2: TcxTextEdit;
|
|||
|
|
ccqx_temperature3: TcxTextEdit;
|
|||
|
|
ccqx_temperature4: TcxTextEdit;
|
|||
|
|
ccqx_temperature5: TcxTextEdit;
|
|||
|
|
ccqx_temperature6: TcxTextEdit;
|
|||
|
|
TbCCQXReplace: TcxButton;
|
|||
|
|
TbccqxClear: TcxButton;
|
|||
|
|
cxLabel41: TcxLabel;
|
|||
|
|
cxLabel42: TcxLabel;
|
|||
|
|
cxLabel45: TcxLabel;
|
|||
|
|
cxLabel46: TcxLabel;
|
|||
|
|
cxLabel47: TcxLabel;
|
|||
|
|
cxLabel48: TcxLabel;
|
|||
|
|
cxGrid4: TcxGrid;
|
|||
|
|
TvCCQX: TcxGridDBTableView;
|
|||
|
|
TvCCQXccqx_Name: TcxGridDBColumn;
|
|||
|
|
Tv1ccqx_rate: TcxGridDBColumn;
|
|||
|
|
TvCCQXserialno: TcxGridDBColumn;
|
|||
|
|
cxGridLevel4: TcxGridLevel;
|
|||
|
|
cxLabel1: TcxLabel;
|
|||
|
|
TbCCQXAdd: TcxButton;
|
|||
|
|
TbCCQXDel: TcxButton;
|
|||
|
|
ccqx_note: TcxMemo;
|
|||
|
|
DS_CCQX: TDataSource;
|
|||
|
|
CDS_CCQX: TClientDataSet;
|
|||
|
|
TvCCQXccqx_spel: TcxGridDBColumn;
|
|||
|
|
TvCCQXccqx_unit: TcxGridDBColumn;
|
|||
|
|
TvCCQXBPIID: TcxGridDBColumn;
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure TbCCQXReplaceClick(Sender: TObject);
|
|||
|
|
procedure TbccqxClearClick(Sender: TObject);
|
|||
|
|
procedure TbCCQXAddClick(Sender: TObject);
|
|||
|
|
procedure TbCCQXDelClick(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn2PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure Tv1ccqx_ratePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
procedure FillAllTextEditsWithValue(AParent: TWinControl; const AHint, AValue: string; AExclude: TcxTextEdit = nil);
|
|||
|
|
procedure ClearAllTextEditsByHint(AParent: TWinControl; const AHint: string; AExclude: TcxTextEdit = nil);
|
|||
|
|
function FindLastEditedTextEdit(AParent: TWinControl; const AHint: string): string;
|
|||
|
|
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
procedure InitGrid();
|
|||
|
|
function SaveData(mPSid: string): Boolean;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_LabelPrint,U_ProductInfoSel;
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.InitGrid();
|
|||
|
|
begin
|
|||
|
|
// POSNO.SetFocus;
|
|||
|
|
// try
|
|||
|
|
// ADOQueryMain.DisableControls;
|
|||
|
|
// with ADOQueryMain do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// SQL.Clear;
|
|||
|
|
// sql.Add(' select A.* from BS_Position A order by POSNO ');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
|
// SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
|
// finally
|
|||
|
|
// ADOQueryMain.EnableControls;
|
|||
|
|
// ToolButton2.Click;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.TbCCQXAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
with CDS_CCQX do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
CDS_CCQX.FieldByName('serialno').Value := CDS_CCQX.RecordCount + 1;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.TbccqxClearClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ClearAllTextEditsByHint(panel_ccqx, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>¿<EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.TbCCQXDelClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
if not CDS_CCQX.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_CCQX.fieldbyname('BCPID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete BS_Cloth_GY_Sub where BCPID=' + quotedStr(Trim(CDS_CCQX.fieldbyname('BCPID').AsString)));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_CCQX.Delete;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
i := 0;
|
|||
|
|
CDS_CCQX.First;
|
|||
|
|
while not CDS_CCQX.Eof do
|
|||
|
|
begin
|
|||
|
|
i := i + 1;
|
|||
|
|
CDS_CCQX.Edit;
|
|||
|
|
CDS_CCQX.fieldByName('serialno').value := i;
|
|||
|
|
CDS_CCQX.Post;
|
|||
|
|
CDS_CCQX.Next;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.TbCCQXReplaceClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FillAllTextEditsWithValue(panel_ccqx, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>¿<EFBFBD>', FindLastEditedTextEdit(panel_ccqx, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>¿<EFBFBD>'));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.ToolButton3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
RTValues: TArray<string>;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if CDS_HZ.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_HZ.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
RTValues := SelCDSKey(CDS_HZ, ['POSID']);
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'Position';
|
|||
|
|
FFiltration1 := RTValues[0];
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.ToolButton5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.Locate('SSel', True, []) = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete BS_Position where POSID=' + QuotedStr(CDS_HZ.FieldByName('POSID').AsString));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
CDS_HZ.Edit;
|
|||
|
|
CDS_HZ.FieldByName('SSel').Value := False;
|
|||
|
|
CDS_HZ.Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.Tv1ccqx_ratePropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
s: string;
|
|||
|
|
fValue: Double;
|
|||
|
|
begin
|
|||
|
|
s := TcxTextEdit(Sender).EditingText;
|
|||
|
|
|
|||
|
|
if (s <> '') and (s[Length(s)] <> '%') then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
// <20><><EFBFBD>Խ<EFBFBD><D4BD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
fValue := StrToFloat(s);
|
|||
|
|
// <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD><CEAA>λС<CEBB><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱٷֺ<D9B7>
|
|||
|
|
TvCCQX.Controller.FocusedColumn.EditValue := FormatFloat('0.00', fValue) + '%';
|
|||
|
|
except
|
|||
|
|
on E: EConvertError do
|
|||
|
|
begin
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱٷֺ<D9B7>
|
|||
|
|
TvCCQX.Controller.FocusedColumn.EditValue := s + '%';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TframeCCQXList.SaveData(mPSid: string): Boolean;
|
|||
|
|
var
|
|||
|
|
MaxProcessID, MaxBCPID, MaxPSID, MaxDTMID, mDTMID, DTMPSlist: string;
|
|||
|
|
maxsubid1, maxsubid2, maxsubid3, maxsubid4, maxsubid5, maxsubid6, mmaxgx: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Bs_Cloth_GY_Main where PSID=''' + Trim(mPSid) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(mPSid) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('PSID').Value := Trim(mPSid);
|
|||
|
|
|
|||
|
|
RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', Panel_ccqx, 2);
|
|||
|
|
ADOQueryCmd.Post;
|
|||
|
|
|
|||
|
|
////////////////// <20><><EFBFBD>泤<EFBFBD><E6B3A4><EFBFBD><EFBFBD>ϴ<EFBFBD>ӱ<EFBFBD> //////////////////////
|
|||
|
|
with CDS_CCQX do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if Trim(CDS_CCQX.fieldbyname('BCPID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryTemp, maxsubid1, 'CCQX', 'Bs_Cloth_GY_Sub', 5, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxsubid1 := Trim(CDS_CCQX.fieldbyname('BCPID').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Bs_Cloth_GY_Sub where ');
|
|||
|
|
sql.Add(' BCPID=''' + Trim(maxsubid1) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_CCQX.fieldbyname('BCPID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
FieldByName('GYType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ';
|
|||
|
|
FieldByName('PSID').Value := Trim(mPSid);
|
|||
|
|
FieldByName('BCPID').Value := Trim(maxsubid1);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, TvCCQX, CDS_CCQX, 'Bs_Cloth_GY_Sub', 0);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
//////////////// <20><><EFBFBD>泤<EFBFBD><E6B3A4><EFBFBD><EFBFBD>ϴ<EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
|
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
|
|
|||
|
|
|
|||
|
|
// FPSID := maxId;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.cxGridDBColumn2PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmProductInfoSel := TfrmProductInfoSel.Create(Application);
|
|||
|
|
with frmProductInfoSel do
|
|||
|
|
begin
|
|||
|
|
FSTKName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_CCQX do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('ccqx_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
|
|||
|
|
FieldByName('ccqx_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Type').value;
|
|||
|
|
|
|||
|
|
FieldByName('ccqx_unit').Value := frmProductInfoSel.CDS_1.fieldbyname('QtyUnit').value;
|
|||
|
|
FieldByName('BPIID').Value := frmProductInfoSel.CDS_1.fieldbyname('BPIID').value;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmProductInfoSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.FillAllTextEditsWithValue(AParent: TWinControl; const AHint, AValue: string; AExclude: TcxTextEdit = nil); // <20><>ѡ<EFBFBD><D1A1><EFBFBD>ų<EFBFBD><C5B3>ض<EFBFBD><D8B6>ؼ<EFBFBD>
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
AControl: TControl;
|
|||
|
|
ATextEdit: TcxTextEdit;
|
|||
|
|
begin
|
|||
|
|
for i := 0 to AParent.ControlCount - 1 do
|
|||
|
|
begin
|
|||
|
|
AControl := AParent.Controls[i];
|
|||
|
|
if (AControl is TcxTextEdit) and ((AControl as TcxTextEdit).Text = '') then
|
|||
|
|
begin
|
|||
|
|
ATextEdit := AControl as TcxTextEdit;
|
|||
|
|
if (ATextEdit.Hint = AHint) and (ATextEdit <> AExclude) then
|
|||
|
|
ATextEdit.Text := AValue;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeCCQXList.ClearAllTextEditsByHint(AParent: TWinControl; const AHint: string; AExclude: TcxTextEdit = nil);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
AControl: TControl;
|
|||
|
|
begin
|
|||
|
|
for i := 0 to AParent.ControlCount - 1 do
|
|||
|
|
begin
|
|||
|
|
AControl := AParent.Controls[i];
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD> TcxTextEdit<69><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Hint ƥ<>䣬<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ų<EFBFBD><C5B3>Ŀؼ<C4BF>
|
|||
|
|
if (AControl is TcxTextEdit) and (TcxTextEdit(AControl).Hint = AHint) and (TcxTextEdit(AControl) <> AExclude) then
|
|||
|
|
begin
|
|||
|
|
TcxTextEdit(AControl).Text := ''; // ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TframeCCQXList.FindLastEditedTextEdit(AParent: TWinControl; const AHint: string): string;
|
|||
|
|
var
|
|||
|
|
i, j: Integer;
|
|||
|
|
AControl: TControl;
|
|||
|
|
SortedControls: TList;
|
|||
|
|
TempControl: TControl;
|
|||
|
|
begin
|
|||
|
|
Result := '';
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ӿؼ<D3BF><D8BC><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7>ؿ<EFBFBD>
|
|||
|
|
if AParent.ControlCount = 0 then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
// ʹ<><CAB9> TList <20>洢<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݾɰ<DDBE> Delphi<68><69>
|
|||
|
|
SortedControls := TList.Create;
|
|||
|
|
try
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿؼ<D3BF><D8BC><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD>
|
|||
|
|
for i := 0 to AParent.ControlCount - 1 do
|
|||
|
|
SortedControls.Add(AParent.Controls[i]);
|
|||
|
|
|
|||
|
|
// <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD> Top<6F><70>Y<EFBFBD><59><EFBFBD>꣩<EFBFBD><EAA3A9> Left<66><74>X<EFBFBD><58><EFBFBD>꣩<EFBFBD><EAA3A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
for i := 0 to SortedControls.Count - 1 do
|
|||
|
|
begin
|
|||
|
|
for j := i + 1 to SortedControls.Count - 1 do
|
|||
|
|
begin
|
|||
|
|
// <20>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> Top <20><> Left
|
|||
|
|
if (TControl(SortedControls[i]).Top > TControl(SortedControls[j]).Top) or ((TControl(SortedControls[i]).Top = TControl(SortedControls[j]).Top) and (TControl(SortedControls[i]).Left > TControl(SortedControls[j]).Left)) then
|
|||
|
|
begin
|
|||
|
|
// <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
|
TempControl := TControl(SortedControls[i]);
|
|||
|
|
SortedControls[i] := SortedControls[j];
|
|||
|
|
SortedControls[j] := TempControl;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀؼ<C4BF>
|
|||
|
|
for i := 0 to SortedControls.Count - 1 do
|
|||
|
|
begin
|
|||
|
|
AControl := TControl(SortedControls[i]);
|
|||
|
|
if (AControl is TcxTextEdit) and (TcxTextEdit(AControl).Hint = AHint) and (TcxTextEdit(AControl).Text <> '') then
|
|||
|
|
begin
|
|||
|
|
Result := TcxTextEdit(AControl).Text; // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļᱻ<C4BB><E1B1BB><EFBFBD><EFBFBD>
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
SortedControls.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|