./
mgffprefs__define.pro
includes main-level programClass responsible for storing and retrieving preferences. Preferences are persistent across IDL sessions on the same computer.
Examples
    The main-level program at the end of this file has an example use of
    MGffPrefs. To run it, type:
  IDL> .run mgffprefs__define
MFffPrefs object and uses the set and get
    methods to set and retrieve a preference.
    Creating the MGffPrefs requires setting the AUTHOR_NAME and
    APP_NAME properties so that the APP_DIRECTORY, where the prefence
    value files are stored, can be specified:
  authorName = 'mgffprefs_demo'
  appName = 'mgffprefs_demo'
  prefs = obj_new('mgffprefs', author_name=authorName, app_name=appName)
  prefs->set, 'name', 'Michael'
  obj_destroy, prefs
MGffPrefs object is created with the same AUTHOR_NAME and
    APP_NAME values:
  prefs = obj_new('mgffprefs', author_name=authorName, app_name=appName)
  name = prefs->get('name', found=found)
APP_DIRECTORY property to know where the preference
    files are stored:
  prefs->getProperty, app_directory=appdir
MGffPrefs object:
  obj_destroy, prefs
  print, name, format='(%"Preference value for name: %s")'
  file_delete, file_dirname(appdir), /recursive, /allow_nonexistent, /quiet
clear method.
Class description for mgffprefs
Properties
- author_name init
 short name of the author
- app_name init
 short name of the application
- app_description init
 full name of the application
- author_description init
 full name of the author
- app_directory get
 location of the directory for the application using these preferences
Routines
mgffprefs::set, prefname, prefvalueSave the value of a preference.
mgffprefs::clear, prefnameClear the value of a preference.
result = mgffprefs::get(prefname [, /found] [, default=any] [, /names])Retrieve the value of a preference.
mgffprefs::getProperty, app_directory=app_directoryGet properties.
mgffprefs::cleanupFree resources.
result = mgffprefs::init(author_name=string, app_name=string [, author_description=string] [, app_description=string])Initialize a prefs object.
mgffprefs__defineDefine instance variables.
Routine details
top source mgffprefs::set
mgffprefs::set, prefname, prefvalue
Save the value of a preference.
Parameters
- prefname in required type=string
 case-insensitive name of preference to retrieve
- prefvalue in required type=any
 value of the preference
top source mgffprefs::clear
mgffprefs::clear, prefname
Clear the value of a preference.
Parameters
- prefname in required type=string
 case-insensitive name of preference to retrieve
top source mgffprefs::get
result = mgffprefs::get(prefname [, /found] [, default=any] [, /names])
Retrieve the value of a preference.
Return value
preference value
Parameters
- prefname in required type=string
 case-insensitive name of preference to retrieve
Keywords
- found out optional type=boolean
 set to a named variable to return whether the preference was found
- default in optional type=any
 default value to use if no preference value is found for the given preference name
- names in optional type=boolean
 set to return a list of the preference names instead of a value; names may not agree exactly with the names given in the set method because they have been modified to make valid filename
top source mgffprefs::getProperty
mgffprefs::getProperty, app_directory=app_directory
Get properties.
Keywords
- app_directory
 location of the directory for the application using these preferences
top source mgffprefs::init
result = mgffprefs::init(author_name=string, app_name=string [, author_description=string] [, app_description=string])
Initialize a prefs object.
Return value
1 for success, 0 for failure
Keywords
short name of the author
- app_name in required type=string
 short name of the application
full name of the author
- app_description in optional type=string
 full name of the application
File attributes
| Modification date: | Tue Feb 1 11:13:36 2011 | 
| Lines: | 309 | 
| Docformat: | rst rst | 
![[attach.png]](idldoc-resources/attach.png)