Resizing SmartList TreeView and ListView panes using the Support Debugging Tool
This article is another Support Debugging Tool Non-Logging Trigger example and is a follow up to two previous articles:
- From this blog: Adding Window Size and Position Memory using the Support Debugging Tool
- From Mark Polino: Dynamic Future - Vote - Resize the Left Pane on Smartlists
This example stores the size and position of the SmartList window using a very similar technique to the post from earlier this week. The main difference is that instead of storing a setting in the Dex.ini file, this time it uses a Support Debugging Tool Parameter. These Parameters are stored in the SY_User_Object_Store (SY90000) table, this is the same table that Visual Basic for Applications uses for the DUOS (Dynamic User Object Store).
The reason that the code uses the DUOS table instead of the a Dex.ini setting is so that it can handle being used in a terminal server or Citrix farm environment.
Below is the reasoning:
- If the setting was left as a Dex.ini setting, it would affect all users using the workstation and would not allow individual users to control the setting the way they wanted it. Each user can change the single setting and this will affect other users on that workstation.
- Also in a farm environment, the Dex.ini setting on each of the servers on the farm is a different file and so has different settings. This means that the setting would change based on the server accessed for a particular remote session and so there is very little chance of consistency.
- By using a Parameter stored the DUOS table, the setting is stored on a per user, per company basis and will follow the user regardless of the physical workstation or server being used.
The other big difference with this example is the enhancement to allow control of the size of the left hand (TreeView) and right hand (ListView) panes of the SmartList window. As mentioned in Mark's post, when the window is resized the size of the left pane increases to a point where it is much larger than required and is wasting a huge amount of screen real estate.
Example screenshot showing large amount of white space for left pane of Smartlist window
With this customisation, the size of the left pane can be set as a percentage of the total window size ranging from 5% to 95%. I have found that a value of 10% or 15% works well.
Example screenshot showing reduced amount of white space for left pane of Smartlist window
Notes:
- To change the size of the left hand pane of the SmartList window, from the Additional menu, use the option "Change size of SmartList Window left hand pane". This will display the current percentage ratio value for the left hand pane and allow you to change it.
- When the window is resized after the left hand pane has been made smaller, it is possible for the left hand pane to disappear entirely. If this happens, either use the menu option to re-select the size you want, or click on another window and then click back on SmartList window for the previously set ratio to be re-applied.
- The position information is relative to the Microsoft Dynamics GP main application window and so can show negative figures when the window was last positioned higher than or left of the main window.
The example uses four Trigger IDs:
- SMARTLIST_POST
This trigger captures the size and position information of the window and the percentage ratio of the left hand TreeView pane just before it closes and writes this information into DUOS table as the Parameter Win_SmartList.
- SMARTLIST_PRE
This trigger reads the previously written Parameter and parses the line to size and position information. It then adjusts the SmartList window's size and position just before it is opened.
- SMARTLIST_SIZE
This trigger adds the menu choice to the Additional Menu and allows the percentage ratio for the left hand pane of the SmartList window to be selected. Once a ratio is selected, the number of pixels needed to adjust the window fields by is calculated and the adjustments made. Also, the settings for the current size and position and percentage ratio are stored back into the Parameter.
- SMARTLIST_ACT
This trigger works whenever the SmartList window gains focus. It reads the previously written Parameter and parses the left hand pane percentage ratio and then makes the appropriate adjustments to the window fields.
Use of the SMARTLIST_ACT trigger on the WindowActivate event was required as using the SMARTLIST_PRE on the Form Pre event was too early and the window field size changes did not take effect.
The Support Debugging Tool Debugger Settings file with these triggers is attached as an archive to the bottom of this post.
Please leave a comment if you find this example useful.
David
Debugger Settings SmartList Window Size & Pane.dbg.zip
Comments
Anonymous
July 19, 2012
Thanks for the wonderful article... :) Smartlist pane resizing has been a topic quite some time and there are product suggestions which have been placed in Microsoft Connect. :) This is very helpful.Anonymous
July 21, 2012
Posting from Jivtesh Singh at About Dynamics, Development and Life www.jivtesh.com/.../smartlist-left-pane-resizing-awesomeness.htmlAnonymous
July 23, 2012
Posting Mark Polino at DynamicAccounting.net msdynamicsgp.blogspot.com.au/.../resizing-smartlist-treeview-and.htmlAnonymous
August 02, 2012
How do you load the xml file?Anonymous
August 02, 2012
Hi Alicia After loading the Support Debugging Tool. Goto Tools >> Support Debugging Tool and then use Options >> Configuration Export/Import to load the debugger settings xml file. Use the path button to find it and click Import. If you want all users to have this functionality, you will need to ensure the Support Debugging Tool is set up using the Recommended Configuration as described in the User Guide PDF. DavidAnonymous
February 05, 2013
I was able to upload and implement the code, yet SmartList shortcuts are no longer working for my team (as they once were). I will need to roll this back - I'm just hoping I can! Thanks...Anonymous
February 05, 2013
Hi Darin To disable the code, you can either mark the triggers as disabled or delete them entirely. From the Support Debugging Tool main window, select Options >> Automatic Debugger Mode Status and use the Unregister button to unregister all Triggers. Then select Options >> Setup Automatic Debugger Mode and click on the Administration Button. From there you can mark the triggers for deletion, mark them as disabled or set them to not start automatically. Click OK to save the changes. I would be interested in understanding why the shortcuts stopped working as this code should not have any side effects. David