View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037385 | Lazarus | LCL | public | 2020-07-18 05:51 | 2020-09-30 11:25 |
Reporter | Zdravko Gabrovski | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Windows | OS | Windows | ||
Summary | 0037385: DBGrid raises "Can not focus to disable or invisible window" when hides inplace editor | ||||
Description | DBGrid raises "Can not focus to disabe or invisible window" when hide inplace editor after enable dataset controls. To reproduce the problem you must enable "dgAlwaysShowEditor" option. In my case I have a page control with 2 tab controls. In first one there is a DBGrid with dgAlwaysShowEditor set to true. When user change the active tab sheet, I do a dataset "DisableControls", some work over the data, and after that "EnableControls". All this happens in PageControl "OnChange" event handler. After "Enablecontrols" it fire "Can not focus to disable or invisible window" exception. The exception comes from line 7215 in Grids.pas file in DoEditorHide method. ParentForm.ActiveControl := self; To solve the case, I just add a sanity check: if Self.CanFocus then ParentForm.ActiveControl := self; | ||||
Steps To Reproduce | Please, use attached example. 1. Click button "Delete" 2. Click over "TabSheet2". It will raise exception. | ||||
Additional Information | I catch the bug over Win32/64 lcl, but may be there is the same problem over all other widgetsets. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r63596 | ||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
grid.diff (612 bytes)
Index: lazarus/lcl/grids.pas =================================================================== --- lazarus/lcl/grids.pas (revision 63438) +++ lazarus/lcl/grids.pas (working copy) @@ -7212,7 +7212,8 @@ {$ifdef dbgGrid}DebugLnEnter('grid.DoEditorHide [',Editor.ClassName,'] INIT');{$endif} if gfEditingDone in FGridFlags then begin ParentForm := GetParentForm(Self); - ParentForm.ActiveControl := self; + if Self.CanFocus then + ParentForm.ActiveControl := self; end; Editor.Visible:=False; {$ifdef dbgGrid}DebugLnExit('grid.DoEditorHide [',Editor.ClassName,'] END');{$endif} |
|
Please find attached sample project |
|
Applied, thanks. |
|
you are welcome! |
|
Thanks! |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-07-18 05:51 | Zdravko Gabrovski | New Issue | |
2020-07-18 05:51 | Zdravko Gabrovski | File Added: grid.diff | |
2020-07-18 05:52 | Zdravko Gabrovski | Note Added: 0124138 | |
2020-07-18 05:52 | Zdravko Gabrovski | File Added: GridPatch.7z | |
2020-07-18 05:52 | Zdravko Gabrovski | Note Edited: 0124138 | View Revisions |
2020-07-18 23:58 | Juha Manninen | Assigned To | => Juha Manninen |
2020-07-18 23:58 | Juha Manninen | Status | new => assigned |
2020-07-18 23:58 | Juha Manninen | Status | assigned => resolved |
2020-07-18 23:58 | Juha Manninen | Resolution | open => fixed |
2020-07-18 23:58 | Juha Manninen | Fixed in Revision | => r63596 |
2020-07-18 23:58 | Juha Manninen | LazTarget | => - |
2020-07-18 23:58 | Juha Manninen | Widgetset | Win32/Win64 => Win32/Win64 |
2020-07-18 23:58 | Juha Manninen | Note Added: 0124160 | |
2020-07-21 20:48 | Zdravko Gabrovski | Note Added: 0124217 | |
2020-09-30 11:25 | Zdravko Gabrovski | Status | resolved => closed |
2020-09-30 11:25 | Zdravko Gabrovski | Note Added: 0125982 |