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.Acana_FactuGES2/trunk@326 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
ef9df1d20e
commit
2cb6934575
@ -64,7 +64,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
DroppedDownWidth = 145
|
DroppedDownWidth = 145
|
||||||
MaxMRUCount = 0
|
MaxMRUCount = 0
|
||||||
FontName = 'Tahoma'
|
FontName = 'Tahoma'
|
||||||
ItemIndex = 35
|
ItemIndex = 34
|
||||||
Options = [foTrueTypeOnly, foNoOEMFonts, foScalableOnly, foWysiWyg]
|
Options = [foTrueTypeOnly, foNoOEMFonts, foScalableOnly, foWysiWyg]
|
||||||
Sorted = True
|
Sorted = True
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
@ -153,6 +153,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
Align = alClient
|
Align = alClient
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object cxGridView: TcxGridDBTableView
|
object cxGridView: TcxGridDBTableView
|
||||||
|
OnKeyDown = cxGridViewKeyDown
|
||||||
NavigatorButtons.ConfirmDelete = False
|
NavigatorButtons.ConfirmDelete = False
|
||||||
FilterBox.Visible = fvNever
|
FilterBox.Visible = fvNever
|
||||||
OnEditing = cxGridViewEditing
|
OnEditing = cxGridViewEditing
|
||||||
@ -183,6 +184,9 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
OptionsCustomize.DataRowSizing = True
|
OptionsCustomize.DataRowSizing = True
|
||||||
OptionsData.Appending = True
|
OptionsData.Appending = True
|
||||||
OptionsData.CancelOnExit = False
|
OptionsData.CancelOnExit = False
|
||||||
|
OptionsData.Deleting = False
|
||||||
|
OptionsData.DeletingConfirmation = False
|
||||||
|
OptionsData.Inserting = False
|
||||||
OptionsSelection.InvertSelect = False
|
OptionsSelection.InvertSelect = False
|
||||||
OptionsSelection.MultiSelect = True
|
OptionsSelection.MultiSelect = True
|
||||||
OptionsSelection.UnselectFocusedRecordOnExit = False
|
OptionsSelection.UnselectFocusedRecordOnExit = False
|
||||||
|
|||||||
@ -139,6 +139,8 @@ type
|
|||||||
procedure actAnchoAutomaticoUpdate(Sender: TObject);
|
procedure actAnchoAutomaticoUpdate(Sender: TObject);
|
||||||
procedure cxGridViewInitEdit(Sender: TcxCustomGridTableView;
|
procedure cxGridViewInitEdit(Sender: TcxCustomGridTableView;
|
||||||
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
|
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
|
||||||
|
procedure cxGridViewKeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
|
||||||
private
|
private
|
||||||
FController : IControllerDetallesBase;
|
FController : IControllerDetallesBase;
|
||||||
@ -157,6 +159,7 @@ type
|
|||||||
function darPosicionCAMPO(const Nombre:String): Integer;
|
function darPosicionCAMPO(const Nombre:String): Integer;
|
||||||
function darListaSeleccionados: TIntegerArray;
|
function darListaSeleccionados: TIntegerArray;
|
||||||
|
|
||||||
|
procedure TratamientoTeclas(Key: Word; Shift: TShiftState; AItem: TcxCustomGridTableItem = nil);
|
||||||
protected
|
protected
|
||||||
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||||
function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||||
@ -328,6 +331,13 @@ end;
|
|||||||
procedure TfrViewDetallesBase.CustomViewCreate(Sender: TObject);
|
procedure TfrViewDetallesBase.CustomViewCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
inherited;
|
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;
|
CurEdit := Nil;
|
||||||
FUpdating := False;
|
FUpdating := False;
|
||||||
end;
|
end;
|
||||||
@ -349,53 +359,7 @@ procedure TfrViewDetallesBase.cxGridViewEditKeyDown(
|
|||||||
AEdit: TcxCustomEdit; var Key: Word; Shift: TShiftState);
|
AEdit: TcxCustomEdit; var Key: Word; Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
cxGridView.BeginUpdate;
|
TratamientoTeclas(Key, Shift, AItem);
|
||||||
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;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrViewDetallesBase.cxGridViewEditValueChanged(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem);
|
procedure TfrViewDetallesBase.cxGridViewEditValueChanged(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem);
|
||||||
@ -460,6 +424,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrViewDetallesBase.cxGridViewKeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
TratamientoTeclas(Key, Shift);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrViewDetallesBase.cxGridViewStylesGetContentStyle(
|
procedure TfrViewDetallesBase.cxGridViewStylesGetContentStyle(
|
||||||
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
||||||
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||||||
@ -734,6 +705,58 @@ begin
|
|||||||
cxGridView.Controller.EditingController.Edit.PostEditValue;
|
cxGridView.Controller.EditingController.Edit.PostEditValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrViewDetallesBase.TratamientoTeclas(Key: Word; Shift: TShiftState;
|
||||||
|
AItem: TcxCustomGridTableItem);
|
||||||
|
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);
|
procedure TfrViewDetallesBase.actAnadirUpdate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user