View unanswered posts | View active topics



Reply to topic  [ 3 posts ] 
TabbedDocument SciControl 
Author Message
Member

Joined: Thu Feb 02, 2012 5:59 pm
Posts: 78
Location: Alabama
Reply with quote
I was noticing some odd behavior while updating my NavigationBar extension to work with the Split View. I was expecting the TabbedDocument.SciControl property to return the last focused editor. However once the Split Editor lost focus, for instance by clicking on one of my dropdowns, the property would always return the Top Editor. This caused the wrong Editor to be updated.

I verified that the Outline behaves in the same manner. To see for yourself open a project, enabled Split View, click in the lower Editor, and then use the Outline to navigate to a different method.

This patch changes the behavior so that the TabbedDocument will track the last editor to have focus and return it from the SciControl property. It does handle the case that the user had the cursor in the Split Editor then exited Split View without clicking in the Top Editor.

Code:
Index: FlashDevelop/Docking/TabbedDocument.cs
===================================================================
--- FlashDevelop/Docking/TabbedDocument.cs   (revision 2701)
+++ FlashDevelop/Docking/TabbedDocument.cs   (working copy)
@@ -25,6 +25,7 @@
         private String previousText;
         private ScintillaControl editor;
         private ScintillaControl editor2;
+        private ScintillaControl lastFocusedEditor;
         private SplitContainer splitContainer;
         private Boolean useCustomIcon;
         private Boolean isModified;
@@ -120,6 +121,9 @@
         {
             get
             {
+                if (lastFocusedEditor != null && lastFocusedEditor.Visible)
+                    return lastFocusedEditor;
+
                 foreach (Control ctrl in this.Controls)
                 {
                     if (ctrl is ScintillaControl && !this.Disposing) return ctrl as ScintillaControl;
@@ -286,6 +290,7 @@
         {
             if (sender.IsFocus)
             {
+                this.lastFocusedEditor = sender;
                 this.editor.DisableAllSciEvents = (sender == editor2);
                 this.editor2.DisableAllSciEvents = (sender == editor);
             }


Wed Jul 03, 2013 1:05 pm
Profile WWW
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3046
Location: Finland
Reply with quote
Thanks, added to SVN.


Tue Aug 13, 2013 9:55 am
Profile WWW
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3046
Location: Finland
Reply with quote
I needed to adjust this patch a little bit as i started to recieve NP crashes but it should be better now and work correctly.


Wed Aug 14, 2013 7:28 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.