dist_tools/
mg_prefs__define.pro
Preferences are stored between IDL sessions in SAV files in the directory returned by APP_USER_DIR.
Examples
To store a preference:
IDL> prefs = obj_new('mg_prefs', author='mgalloy', application='myapp')
IDL> prefs->set, 'last_edited', 'myfile.txt'
Then in a later IDL sesson this preference can be retrieved:
IDL> prefs = obj_new('mg_prefs', author='mgalloy', application='myapp')
IDL> print, prefs->get('last_edited')
myfile.txt
Class description for mg_prefs
Properties
- application init
- author init
Fields
- configdir ''
directory containing preference files
Routines
result = mg_prefs::_constructFilename(prefname)Converts a preference to a full path specified filename to store the preference.
result = mg_prefs::get(prefname, default=default, found=found)mg_prefs::set, prefname, prefvalueSet a preference.
mg_prefs::cleanupFree resources.
result = mg_prefs::init(author=string, application=string)Initialize a preference object.
mg_prefs__defineDefine instance variables.
Routine details
topmg_prefs::_constructFilenameprivate
result = mg_prefs::_constructFilename(prefname)
Converts a preference to a full path specified filename to store the preference.
Return value
string
Parameters
- prefname in required type=string
prefname to convert to a filename
topmg_prefs::get
result = mg_prefs::get(prefname, default=default, found=found)
Parameters
- prefname
Keywords
- default
- found
topmg_prefs::set
mg_prefs::set, prefname, prefvalue
Set a preference.
Parameters
- prefname in required type=string
preference name
- prefvalue in required type=any
preference value
topmg_prefs::init
result = mg_prefs::init(author=string, application=string)
Initialize a preference object.
Return value
1 for success, 0 for failure
Keywords
author name
- application in required type=string
application name
File attributes
| Modification date: | Fri Mar 28 13:58:30 2008 |
| Lines: | 126 |
| Docformat: | rst rst |
![[attach.png]](../idldoc-resources/attach.png)