cxGrid使用汇总
2017-12-10 21:23
961 查看
1、自动行高:CellAutoHeight(单元自动高度)设置为True.
[/code]
procedure TForm_Sales.col_Reg_Price_UnitPropertiesEditValueChanged(
Sender: TObject);
var Edit : TcxCustomEdit;
c_Now,
c_Was : currency;
i_Rate : integer;
begin
Edit := Sender as TcxCustomEdit;
if (Edit <> nil) and
(Table_Reg.FieldByName(GD_Tab_Sales_Items_Quan).AsFloat > 0) then
begin
c_Now := Edit.EditingValue;
c_Was := Table_Reg.FieldByName(GD_Tab_Sales_Items_Retail_Unit).AsCurrency;
i_Rate := 100 - trunc(100 * (c_Now / c_Was));
if (i_Rate > Info_Clerk.Discount_Max) then
begin
tv_Reg.DataController.SetEditValue(col_Reg_Price_Unit.Index,
Table_Reg.FieldByName(GD_Tab_Sales_Items_Price_Unit).AsCurrency,
evsValue);
ShowMessage(‘The requested discount of ' + IntToStr(i_rate) + '% exceeds the allowed maximum clerk discount of ' + IntToStr(Info_Clerk.Discount_Max) + '%.');
end;
end;
end;
procedure <AForm>.<AGridColumn>PropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var AColumn: TcxGridDBColumn; AColIndex: Integer; begin AColumn := <AcxGridDBTableView>.GetColumnByFieldName(<Field Name>); AColIndex := AColumn.Index; ... end;
[/code]
procedure TForm_Sales.col_Reg_Price_UnitPropertiesEditValueChanged(
Sender: TObject);
var Edit : TcxCustomEdit;
c_Now,
c_Was : currency;
i_Rate : integer;
begin
Edit := Sender as TcxCustomEdit;
if (Edit <> nil) and
(Table_Reg.FieldByName(GD_Tab_Sales_Items_Quan).AsFloat > 0) then
begin
c_Now := Edit.EditingValue;
c_Was := Table_Reg.FieldByName(GD_Tab_Sales_Items_Retail_Unit).AsCurrency;
i_Rate := 100 - trunc(100 * (c_Now / c_Was));
if (i_Rate > Info_Clerk.Discount_Max) then
begin
tv_Reg.DataController.SetEditValue(col_Reg_Price_Unit.Index,
Table_Reg.FieldByName(GD_Tab_Sales_Items_Price_Unit).AsCurrency,
evsValue);
ShowMessage(‘The requested discount of ' + IntToStr(i_rate) + '% exceeds the allowed maximum clerk discount of ' + IntToStr(Info_Clerk.Discount_Max) + '%.');
end;
end;
end;
procedure TForm1.cxDateEdit1PropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); begin if DisplayValue = 'TEST' then begin DisplayValue := '01/01/2004'; Error := False; end; end;