View unanswered posts | View active topics


Reply to topic  [ 2 posts ] 
Saving state in SettingsDialog 
Author Message
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 333
Location: Lviv, Ukraine
Post Saving state in SettingsDialog
When playing with settings, it is little annoying to select the same plugin every time ProgramSettings has opened.
Especially if it is needed to scroll down the plugin list.

This patch restores previous selected item on opening SettingsDialog.
http://dl.dropbox.com/u/1674435/fd/settings-patch.patch

I just added few lines of code, but VS makes a lot of changes in a generated part of the modified file.
Code:
+            this.Shown += new System.EventHandler(this.SettingDialog_Shown);
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingDialog_FormClosing);
 
+        private static int lastItemIndex = 0;
+
+        private void SettingDialog_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            lastItemIndex = itemListView.SelectedIndices.Count > 0 ? itemListView.SelectedIndices[0] : 0;
+        }
+
+        private void SettingDialog_Shown(object sender, EventArgs e)
+        {
+            itemListView.SelectedIndices.Add(lastItemIndex);
+            itemListView.EnsureVisible(lastItemIndex);
+        }
+


Thu Oct 07, 2010 12:51 pm
Profile WWW
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 2543
Location: Finland
Post Re: Saving state in SettingsDialog
Applied to the SVN, thanks again!


Thu Oct 07, 2010 9:00 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


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

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