Up

Class Ini


This package provides an easy way to save and restore the state of an application's views and options using “ini” text files. For example, you can easily save and restore an application’s size and position, listview column sizes, splitter proportions, fonts, and other settings.

The online Developer Guide goes through the development of the package in detail, explaining the why's and how's, limitations and extensions.

Installation and Quick Start

To install and use Class Ini,
  1. Download the Ini package and install it in your image.
  2. Add "Ini readWriteOn: self" to your application shell's #onViewOpened method.
  3. Run and test your application -- change its size and position, change listview column sizes, move any splitters. Exit and reopen the application -- the changes you made should be restored.
If you find some state not restored, it probably means that you need to go into the View Composer and assign names to some views (Ini only saves state of named views) -- for example, you may have unnamed container views separated by a splitter, in which case you need to name the container views so that their proportions (#arrangement aspect) will be saved.

Note that an "ini" file will be created. When using the development image, the name of this file will be [imageName].ini. In a runtime application, the filename will be [applicationName].ini.

To explicitly save and restore application specific values, use the Ini write and read methods. For example:

MyApp>>iniWrite: anIni
	super iniWrite: anIni.
	anIni
		writeKey: 'Filename' value: self filename;
		writeKey: 'IsAutoPrompt' value: self isAutoPrompt;
		writeKey: 'Threshold' value: self threshold

MyApp>>iniRead: anIni
	super iniRead: anIni.
	self filename: (anIni readString: 'Filename').
	self isAutoPrompt: (anIni readBoolean: 'IsAutoPrompt' default: true).
	self threshold: (anIni readNumber: 'Threshold' default: 1000)
To install the InifileBrowser sample application,
  1. Download the InifileBrowser package.
  2. Download these supporting packages.
If you have questions, comments, suggestions, corrections, etc., please let me know.

Louis Sumberg.