View Issue Details

IDProjectCategoryView StatusLast Update
0029038LazarusPackagespublic2016-01-10 11:27
ReporterOndrej PokornyAssigned ToOndrej Pokorny 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5 (SVN)Product Buildtrunk 
Target Version1.8Fixed in Version1.7 (SVN) 
Summary0029038: [sparta_dockedformeditor]: Ctrl+Tab, Ctrl+Shift+Tab does not work in docked designer
DescriptionThe Next/Prior editor commands ecNextEditor, ecPrevEditor, ecNextEditorInHistory, ecPrevEditorInHistory do not work if docked designer is selected.

Somehow the commands have to be passed over from TDesigner to SourceNotebook.

I did some small research about it:
- One possibility is to pass directly the commands to editor (see patch).
- Second possibility is to call the TSourceNotebook.NextEditor/TSourceNotebook.PrevEditor directly +Next/Prev EditorInHistory (make virtual abstract methods in the IDEIntf).

IMO the first possibility is the better one.
Additional InformationThe patch is obviously wrong. It's just a quick&dirty showcase to have a starting point for developing a proper solution.
TagsDockedFormDesigner
Fixed in Revision51158
LazTarget-
Widgetset
Attached Files
  • prevnextedit-sparta.patch (3,153 bytes)
    Index: designer/designer.pp
    ===================================================================
    --- designer/designer.pp	(revision 50411)
    +++ designer/designer.pp	(working copy)
    @@ -47,7 +47,7 @@
       IDEDialogs, PropEdits, PropEditUtils, ComponentEditors, MenuIntf, IDEImagesIntf,
       FormEditingIntf, ComponentReg, IDECommands, LazIDEIntf, ProjectIntf,
       // IDE
    -  LazarusIDEStrConsts, EnvironmentOpts, EditorOptions,
    +  LazarusIDEStrConsts, EnvironmentOpts, EditorOptions, SourceEditor,
       // Designer
       AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg, TabOrderDlg, AnchorEditor, DesignerProcs,
       CustomFormEditor, AskCompNameDlg, ControlSelection, ChangeClassDialog;
    @@ -2701,6 +2701,8 @@
       Handled: boolean;
       Current: TComponent;
       NewName: String;
    +  ParentForm: TCustomForm;
    +  UTF8Char: TUTF8Char;
     
       procedure Nudge(x, y: integer);
       begin
    @@ -2735,6 +2737,16 @@
       DoProcessCommand(Self, Command, Handled);
       //DebugLn(['TDesigner.KeyDown Command=',Command,' Handled=',Handled,' TheMessage.CharCode=',TheMessage.CharCode]);
     
    +  ParentForm := Screen.ActiveCustomForm;
    +  if not Handled {and (ParentForm<>nil) and (ParentForm is TSourceNotebook)} then
    +    case Command of
    +      ecNextEditor, ecPrevEditor,  ecNextEditorInHistory, ecPrevEditorInHistory:
    +      begin
    +        FillChar(UTF8Char{%H-}, SizeOf(UTF8Char), 0);
    +        SourceEditorManager.SourceWindows[0].ProcessParentCommand(Self, Command, UTF8Char, nil, Handled);
    +      end;
    +    end;
    +
       if not Handled then
       begin
         Handled := True;
    Index: ide/sourceeditor.pp
    ===================================================================
    --- ide/sourceeditor.pp	(revision 50411)
    +++ ide/sourceeditor.pp	(working copy)
    @@ -746,12 +746,6 @@
         procedure GotoNextSharedEditor(Backward: Boolean = False);
         procedure MoveEditorNextWindow(Backward: Boolean = False; Copy: Boolean = False);
         procedure CopyEditor(OldPageIndex, NewWindowIndex, NewPageIndex: integer; Focus: Boolean = False);
    -    procedure ProcessParentCommand(Sender: TObject;
    -       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
    -       var Handled: boolean);
    -    procedure ParentCommandProcessed(Sender: TObject;
    -       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
    -       var Handled: boolean);
     
         function GetActiveEditor: TSourceEditorInterface; override;
         procedure SetActiveEditor(const AValue: TSourceEditorInterface); override;
    @@ -825,6 +819,13 @@
         function GetCapabilities: TCTabControlCapabilities;
         procedure IncUpdateLock;
         procedure DecUpdateLock;
    +
    +    procedure ProcessParentCommand(Sender: TObject;
    +       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
    +       var Handled: boolean);
    +    procedure ParentCommandProcessed(Sender: TObject;
    +       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
    +       var Handled: boolean);
       public
         property Editors[Index:integer]:TSourceEditor read GetEditors; // !!! not ordered for PageIndex
         // The number in the Form.Caption minus 1 (0-based), if multiple Win are open
    

Activities

Ondrej Pokorny

2015-11-19 09:47

reporter  

prevnextedit-sparta.patch (3,153 bytes)
Index: designer/designer.pp
===================================================================
--- designer/designer.pp	(revision 50411)
+++ designer/designer.pp	(working copy)
@@ -47,7 +47,7 @@
   IDEDialogs, PropEdits, PropEditUtils, ComponentEditors, MenuIntf, IDEImagesIntf,
   FormEditingIntf, ComponentReg, IDECommands, LazIDEIntf, ProjectIntf,
   // IDE
-  LazarusIDEStrConsts, EnvironmentOpts, EditorOptions,
+  LazarusIDEStrConsts, EnvironmentOpts, EditorOptions, SourceEditor,
   // Designer
   AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg, TabOrderDlg, AnchorEditor, DesignerProcs,
   CustomFormEditor, AskCompNameDlg, ControlSelection, ChangeClassDialog;
@@ -2701,6 +2701,8 @@
   Handled: boolean;
   Current: TComponent;
   NewName: String;
+  ParentForm: TCustomForm;
+  UTF8Char: TUTF8Char;
 
   procedure Nudge(x, y: integer);
   begin
@@ -2735,6 +2737,16 @@
   DoProcessCommand(Self, Command, Handled);
   //DebugLn(['TDesigner.KeyDown Command=',Command,' Handled=',Handled,' TheMessage.CharCode=',TheMessage.CharCode]);
 
+  ParentForm := Screen.ActiveCustomForm;
+  if not Handled {and (ParentForm<>nil) and (ParentForm is TSourceNotebook)} then
+    case Command of
+      ecNextEditor, ecPrevEditor,  ecNextEditorInHistory, ecPrevEditorInHistory:
+      begin
+        FillChar(UTF8Char{%H-}, SizeOf(UTF8Char), 0);
+        SourceEditorManager.SourceWindows[0].ProcessParentCommand(Self, Command, UTF8Char, nil, Handled);
+      end;
+    end;
+
   if not Handled then
   begin
     Handled := True;
Index: ide/sourceeditor.pp
===================================================================
--- ide/sourceeditor.pp	(revision 50411)
+++ ide/sourceeditor.pp	(working copy)
@@ -746,12 +746,6 @@
     procedure GotoNextSharedEditor(Backward: Boolean = False);
     procedure MoveEditorNextWindow(Backward: Boolean = False; Copy: Boolean = False);
     procedure CopyEditor(OldPageIndex, NewWindowIndex, NewPageIndex: integer; Focus: Boolean = False);
-    procedure ProcessParentCommand(Sender: TObject;
-       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
-       var Handled: boolean);
-    procedure ParentCommandProcessed(Sender: TObject;
-       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
-       var Handled: boolean);
 
     function GetActiveEditor: TSourceEditorInterface; override;
     procedure SetActiveEditor(const AValue: TSourceEditorInterface); override;
@@ -825,6 +819,13 @@
     function GetCapabilities: TCTabControlCapabilities;
     procedure IncUpdateLock;
     procedure DecUpdateLock;
+
+    procedure ProcessParentCommand(Sender: TObject;
+       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
+       var Handled: boolean);
+    procedure ParentCommandProcessed(Sender: TObject;
+       var Command: TSynEditorCommand; var {%H-}AChar: TUTF8Char; {%H-}Data: pointer;
+       var Handled: boolean);
   public
     property Editors[Index:integer]:TSourceEditor read GetEditors; // !!! not ordered for PageIndex
     // The number in the Form.Caption minus 1 (0-based), if multiple Win are open

Balázs Székely

2016-01-03 22:14

developer   ~0088574

@Ondrej
F12 it's not working properly. I can change from Unit to Form view, but not the other way around.

Ondrej Pokorny

2016-01-03 22:19

reporter   ~0088575

How can I disable the global F12 hotkey (pause debugging and show assembler) so that I can check it?

Ondrej Pokorny

2016-01-03 22:19

reporter   ~0088576

Anyway, please open another report.

Balázs Székely

2016-01-03 22:35

developer   ~0088578

Mapp it to another key combination.

Ondrej Pokorny

2016-01-03 22:47

reporter   ~0088580

>> Mapp it to another key combination.

How? I see only "Toggle between Unit and Form" for F12 under "Key mappings".

Balázs Székely

2016-01-03 23:19

developer   ~0088583

It means that "Pause program" or "View assembler(usually Ctrl+Alt+D)" is mapped to F12. Check this with the filter or as a temporary solution, map "Toggle between Unit and Form" to another key combination Ctrl+Shift+F12 for example. The issue is reproducible both with F12/Ctrl+Shift+F12

Issue History

Date Modified Username Field Change
2015-11-19 09:47 Ondrej Pokorny New Issue
2015-11-19 09:47 Ondrej Pokorny File Added: prevnextedit-sparta.patch
2015-11-19 13:00 Juha Manninen Assigned To => Maciej Izak
2015-11-19 13:00 Juha Manninen Status new => assigned
2015-11-20 08:37 Maciej Izak Tag Attached: DockedFormDesigner
2015-11-22 16:33 Ondrej Pokorny Category IDE => Packages
2016-01-03 14:53 Ondrej Pokorny Fixed in Revision => 51158
2016-01-03 14:53 Ondrej Pokorny Status assigned => resolved
2016-01-03 14:53 Ondrej Pokorny Fixed in Version => 1.7 (SVN)
2016-01-03 14:53 Ondrej Pokorny Resolution open => fixed
2016-01-03 14:53 Ondrej Pokorny Assigned To Maciej Izak => Ondrej Pokorny
2016-01-03 22:14 Balázs Székely Note Added: 0088574
2016-01-03 22:19 Ondrej Pokorny Note Added: 0088575
2016-01-03 22:19 Ondrej Pokorny Note Added: 0088576
2016-01-03 22:35 Balázs Székely Note Added: 0088578
2016-01-03 22:47 Ondrej Pokorny Note Added: 0088580
2016-01-03 23:19 Balázs Székely Note Added: 0088583
2016-01-10 11:27 Ondrej Pokorny Status resolved => closed
2016-01-10 11:27 Ondrej Pokorny Target Version => 1.8