Se arregla para que no salten las operaciones de insercion y borrado del grid y si las de nuestro controlador
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@671 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
e2c3ba89ac
commit
b187fc5ab8
@ -156,8 +156,8 @@ type
|
||||
|
||||
procedure cxGridViewEditValueChanged(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem);
|
||||
procedure cxGridViewEditKeyDown(Sender: TcxCustomGridTableView;
|
||||
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit; var Key: Word; Shift: TShiftState);
|
||||
procedure cxGridViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
|
||||
procedure cxGridViewInitEdit(Sender: TcxCustomGridTableView;
|
||||
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
|
||||
@ -198,6 +198,7 @@ type
|
||||
procedure cxGridViewFocusedRecordChanged(Sender: TcxCustomGridTableView;
|
||||
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
||||
ANewItemRecordFocusingChanged: Boolean);
|
||||
|
||||
private
|
||||
FController : IControllerDetallesBase;
|
||||
FDetalles: IDAStronglyTypedDataTable;
|
||||
@ -216,6 +217,8 @@ type
|
||||
function DarListaSeleccionados: TIntegerArray;
|
||||
|
||||
procedure DoPasteText(Sender: TObject; AText: string);
|
||||
procedure TratamientoTeclas(Key: Word; Shift: TShiftState; AItem: TcxCustomGridTableItem = nil);
|
||||
|
||||
protected
|
||||
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||
function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||
@ -571,6 +574,12 @@ end;
|
||||
procedure TfrViewDetallesBase.CustomViewCreate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
//Debemos tener la certeza de que las operaciones del grid estan deshabilitadas y que
|
||||
//cuando pulsamos teclas de insercion flecha abajo y demas salta nuestra propia lógia del controlador
|
||||
cxGridView.OptionsData.Appending := False;
|
||||
cxGridView.OptionsData.Deleting := False;
|
||||
cxGridView.OptionsData.Inserting := False;
|
||||
|
||||
CurEdit := Nil;
|
||||
FUpdating := False;
|
||||
// cxGridView.OptionsView.RowSeparatorColor := dmBase.StyleManager.Colors.ButtonSeparatorColor;
|
||||
@ -594,52 +603,7 @@ procedure TfrViewDetallesBase.cxGridViewEditKeyDown(
|
||||
AEdit: TcxCustomEdit; var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited;
|
||||
cxGridView.BeginUpdate;
|
||||
try
|
||||
case Key of
|
||||
VK_DOWN : begin
|
||||
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
||||
//ya que se saltaria la lógica del controllerDetallesBase
|
||||
if cxGridView.Controller.IsFinish then
|
||||
begin
|
||||
Key := 0;
|
||||
if Sender.Controller.EditingController.IsEditing then
|
||||
Sender.Controller.EditingController.Edit.PostEditValue;
|
||||
actAnadir.Execute;
|
||||
end;
|
||||
|
||||
//Baja los conceptos seleccionados
|
||||
if Shift = [ssAlt] then
|
||||
begin
|
||||
Key := 0;
|
||||
actBajar.Execute;
|
||||
end;
|
||||
end;
|
||||
VK_UP : begin
|
||||
//Sube los conceptos seleccionados
|
||||
if Shift = [ssAlt] then
|
||||
begin
|
||||
Key := 0;
|
||||
actSubir.Execute;
|
||||
end;
|
||||
end;
|
||||
|
||||
VK_RETURN, VK_RIGHT
|
||||
: begin
|
||||
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
||||
//ya que se saltaria la lógica del controllerDetallesBase
|
||||
if cxGridView.Controller.IsFinish and AItem.IsLast then
|
||||
begin
|
||||
Key := 0;
|
||||
if Sender.Controller.EditingController.IsEditing then
|
||||
Sender.Controller.EditingController.Edit.PostEditValue;
|
||||
actAnadir.Execute;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
cxGridView.EndUpdate;
|
||||
end;
|
||||
TratamientoTeclas(Key, Shift, AItem);
|
||||
end;
|
||||
|
||||
procedure TfrViewDetallesBase.cxGridViewEditValueChanged(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem);
|
||||
@ -748,6 +712,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewDetallesBase.cxGridViewKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
inherited;
|
||||
TratamientoTeclas(Key, Shift);
|
||||
end;
|
||||
|
||||
procedure TfrViewDetallesBase.cxGridViewStylesGetContentStyle(
|
||||
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
||||
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||||
@ -1063,6 +1034,57 @@ begin
|
||||
_FocusedView.Controller.EditingController.Edit.PostEditValue;
|
||||
end;
|
||||
|
||||
procedure TfrViewDetallesBase.TratamientoTeclas(Key: Word; Shift: TShiftState; AItem: TcxCustomGridTableItem = nil);
|
||||
begin
|
||||
cxGridView.BeginUpdate;
|
||||
try
|
||||
case Key of
|
||||
VK_DOWN : begin
|
||||
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
||||
//ya que se saltaria la lógica del controllerDetallesBase
|
||||
if cxGridView.Controller.IsFinish then
|
||||
begin
|
||||
Key := 0;
|
||||
if _FocusedView.Controller.EditingController.IsEditing then
|
||||
_FocusedView.Controller.EditingController.Edit.PostEditValue;
|
||||
actAnadir.Execute;
|
||||
end;
|
||||
|
||||
//Baja los conceptos seleccionados
|
||||
if Shift = [ssAlt] then
|
||||
begin
|
||||
Key := 0;
|
||||
actBajar.Execute;
|
||||
end;
|
||||
end;
|
||||
VK_UP : begin
|
||||
//Sube los conceptos seleccionados
|
||||
if Shift = [ssAlt] then
|
||||
begin
|
||||
Key := 0;
|
||||
actSubir.Execute;
|
||||
end;
|
||||
end;
|
||||
|
||||
VK_RETURN, VK_RIGHT
|
||||
: begin
|
||||
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
||||
//ya que se saltaria la lógica del controllerDetallesBase
|
||||
if Assigned(AItem) and
|
||||
cxGridView.Controller.IsFinish and AItem.IsLast then
|
||||
begin
|
||||
Key := 0;
|
||||
if _FocusedView.Controller.EditingController.IsEditing then
|
||||
_FocusedView.Controller.EditingController.Edit.PostEditValue;
|
||||
actAnadir.Execute;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
cxGridView.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewDetallesBase.actAnadirUpdate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user