Individual users can now save/restore their own adjustments to individual XTREE configurations. Currently these adjustments include column widths, column order, sort order, and active column. To activate this new feature, the application must make two changes to the code calling each XTREE:
• | Use the new advanced coldef directive TreeID to give the tree a unique identity, so that any user-directed modifications can be associated with just that one tree. (See notes below.) |
• | Update the XTRCTL map to define the new field XTR'USRCFG and assign it a value from the following, based on which user-configuration options should be allowed to override the application-supplied values: |
Symbol* |
Value |
Description |
Other Parameters Over-ridden |
---|---|---|---|
XTUCFG_COLWID |
1 |
Column widths |
Dspwid (coldef) |
XTUCFG_SRTORD |
2 |
Sort & active col |
xtr'columnactive, xtr'sortorder(),xtr'columnsort() |
XTUCFG_COLORD |
4 |
Column order |
xtr'usecolorder,xtr'colorder() |
XTUCFG_ALL |
255 |
All |
|
*from XTREE.DEF
The new XTR'USRCFG field is defined at the bottom of the current XTRCTL map (see new XTREE.MAP, XTREE.DEF, and XTREE.SDF files in ASHINC:)...
MAP1 XTRCTL
...
MAP2 XTR'NFSELSTYLE,B,1
MAP2 XTR'SEARCHMODE,B,1
MAP2 XTR'USRCFG,B,1 ![127] new cfg save/restore flags
MAP1 XTR'UNUSED2,X,16 ![127] was X,17
The TreeID may consist of an alphanumeric name, with an optional: # suffix where # is the version of the tree (an integer value). The idea of the version is so that if you modify the tree layout during an application update, XTREE will know not to apply previously saved configuration details to the new tree layout.
The TreeID (maximum 32 chars) may also contain "%p" which will be replaced at runtime by the name of the current program. The feature is mainly useful for XTREEs that are implemented within SBX routines that might be called by multiple programs, where you want to allow the user to maintain a separate configuration in each case. So for example, you might use
TreeID=SelCus-%p:1
Note, however, that currently ATE does not know the name of the current program running on the server, so it will replace "%p" with "ATE". If this is a concern, you can always use XCALL GETPRG within your SBX to retrieve the name of the main program and use it directly.
User configuration adjustments are saved in the Registry automatically, provided that TreeID is defined. (If XTR'USRCFG is zero, the settings will be saved on exit, but not restored on entrance, which is one way to force the configuration back to application-specified settings.)
Another way to deal with the possibility that the user accidentally makes a disastrous change to the configuration (like resizing a column to zero width, thus making it disappear entirely), is to define a Popup Menu and add to it the new special command $RESETCFG. For example:
COLDEF=COLDEF+"0~0~x~H~PopupMenu=Misc,VK_xF666;Reset Columns,$RESETCFG~~"
Selecting this option from the menu will cause the tree configuration to be immediately reset back to the way the application had originally intended.
The configuration information is saved in the Registry as:
HKCU\Software\MicroSabio\A-Shell\XTREE\treeid
where treeid is the value specified in the TreeID= coldef clause, but with the version stripped. (The version is saved as a sub-field rather than part of the key, to reduce the proliferation of Registry entries.)