ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/ibcontrols/IBDynamicGrid.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/IBDynamicGrid.pas (file contents):
Revision 29 by tony, Sat May 9 11:37:49 2015 UTC vs.
Revision 31 by tony, Tue Jul 14 15:31:25 2015 UTC

# Line 91 | Line 91 | type
91      FListSource: TDataSource;
92      FOnAutoInsert: TAutoInsert;
93      FOnCanAutoInsert: TCanAutoInsert;
94 +    FOnCloseUp: TNotifyEvent;
95      FOnDrawItem: TDrawItemEvent;
96      FOwner: TIBDynamicGridColumn;
97      FRelationName: string;
# Line 117 | Line 118 | type
118      property Style: TComboBoxStyle read FStyle write FStyle default csDropDown;
119      property OnAutoInsert: TAutoInsert read FOnAutoInsert write FOnAutoInsert;
120      property OnCanAutoInsert: TCanAutoInsert read FOnCanAutoInsert write FOnCanAutoInsert;
121 +    property OnCloseUp: TNotifyEvent read FOnCloseUp write FOnCloseUp;
122      property OnDrawItem: TDrawItemEvent read FOnDrawItem write FOnDrawItem;
123   end;
124  
# Line 177 | Line 179 | end;
179      FWeHaveFocus: boolean;
180      FHidingEditorPanel: boolean;
181      FAllowHide: boolean;
182 +    function ActiveControl: TControl;
183      procedure DoShowEditorPanel(Data: PtrInt);
184      procedure PositionTotals;
185      procedure KeyDownHandler(Sender: TObject; var Key: Word; Shift: TShiftState);
# Line 403 | Line 406 | begin
406        RowHeights[FExpandedRow] := DefaultRowHeight;
407      FExpandedRow := -1;
408      if CanFocus then SetFocus;
406    if assigned(FOnEditorPanelHide) then
407       OnEditorPanelHide(self);
409      DoOnResize;
410      ResetSizes;
411      DoOnChangeBounds;
412 +    if assigned(FOnEditorPanelHide) then
413 +       OnEditorPanelHide(self);
414    end;
415   end;
416  
# Line 489 | Line 492 | begin
492      inherited KeyDown(Key, Shift);
493   end;
494  
495 + function TDBDynamicGrid.ActiveControl: TControl;
496 + var AParent: TWinControl;
497 + begin
498 +  Result := nil;
499 +  AParent := Parent;
500 +  while (AParent <> nil) and  not (AParent is TCustomForm) do
501 +    AParent := AParent.Parent;
502 +  if (AParent <> nil) and (AParent is TCustomForm)then
503 +      Result := TCustomForm(AParent).ActiveControl;
504 + end;
505 +
506   procedure TDBDynamicGrid.DoShowEditorPanel(Data: PtrInt);
507   begin
508    if AppDestroying in Application.Flags then Exit;
# Line 520 | Line 534 | end;
534   procedure TDBDynamicGrid.KeyDownHandler(Sender: TObject; var Key: Word;
535    Shift: TShiftState);
536   var Done: boolean;
537 +    AControl: TControl;
538   begin
539    if Visible and assigned(FEditorPanel) and FEditorPanel.Visible and FWeHaveFocus then
540    begin
541      Done := false;
542 +    AControl := ActiveControl;
543 +    if (AControl <> nil) and (AControl is TCustomComboBox)
544 +                         and ((Key in [VK_UP,VK_DOWN]) or
545 +                         (TCustomComboBox(AControl).DroppedDown and (Key = VK_RETURN)) or
546 +                         ((TCustomComboBox(AControl).Text <> '') and (Key =  VK_ESCAPE))) then
547 +      Exit; {ignore these keys if we are in a  combobox}
548 +
549 +    if (AControl <> nil) and (AControl is TCustomMemo)
550 +                         and (Key = VK_RETURN) then Exit; {Ignore Return in a CustomMemo}
551      if assigned(FOnKeyDownHander) then
552        OnKeyDownHander(Sender,Key,Shift,Done);
553      if Done then Exit;
# Line 770 | Line 794 | begin
794    FCol := Msg.Col;
795    FRow := Msg.Row;
796    FEditText := Msg.Value;
773  SelStart := Length(Text);
797    TIBDynamicGrid(FGrid).SetupEditor(self,FCol);
798   end;
799  
# Line 819 | Line 842 | begin
842      Editor.OnAutoInsert := OnAutoInsert;
843      Editor.OnCanAutoInsert := OnCanAutoInsert;
844      Editor.OnDrawItem := OnDrawItem;
845 +    Editor.OnCloseUp := OnCloseUp;
846  
847      {Setup Data Links}
848      if KeyField <> '' then
# Line 844 | Line 868 | begin
868          Editor.DataSource := TDBGrid(Grid).DataSource;
869    end;
870    Editor.Text := Editor.FEditText;
871 +  Editor.SelStart := Length(Editor.Text);
872   end;
873  
874   procedure TIBDynamicGridColumn.SetInitialSortColumn(AValue: boolean);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines