Fetch (get INI file entries)

Top  Previous  Next

 

 

Fetch( section, | entry, value, filename | ),VIRTUAL, PROTECTED

| entry [, value] |

| window |

 

Fetch

Gets or returns values from the INI file.

section

A string constant, variable, EQUATE, or expression containing the INI file section name.

entry

A string constant, variable, EQUATE, or expression containing the INI file entry name.

value

The label of a variable that contains the default fetched value and receives the actual fetched value. If omitted, there must be a matching section and entry in the INI file for the Fetch method to return.

filename

A string constant, variable, EQUATE, or expression containing the INI file name. If filename specifies a full path, the Fetch method looks for the file in the specified path. If no path is specified, the Fetch method looks for the file in the Windows directory. If filename is specified as null (''), the Fetch method uses the WIN.INI file.

window

The label of the WINDOW or APPLICATION to restore to its previously stored position and size. If this parameter is present, Fetch does not return a value, but restores the window's position and size.

The Fetch method gets or returns values from the INI file.

Fetch(section,entry[,value])

Retrieves a single value specified by section and entry from the INI file specified in the INIClass.FileName property. If a value parameter is present, the Fetch method updates it with the requested value and returns nothing. If no value parameter is present the Fetch method returns the requested value.

Fetch(section,entry,value,filename)

Retrieves a single value specified by section and entry from the INI file specified by filename. The value parameter is updated with the requested value. If the entry or filename does not exist in the INI file, the Fetch method returns an empty string.

Fetch(section,window)

Retrieves and restores several WINDOW attributes saved by a prior corresponding call to Update(section,window) from the INI file specified in the INIClass.FileName property. Restoring the values returns the specified WINDOW to its saved position and size.

Implementation:

If a window is present, the Fetch method gets five entries from the specified INI file section: Maximize, XPos, YPos, Height, and Width. Then it applies the retrieved values to the specified WINDOW or APPLICATION.

Return Data Type:     STRING

Example:

Sound   STRING('ON ')

PWindow  WINDOW('Preferences'),AT(,,89,34),IMM,MAX,RESIZE

         CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')

         BUTTON('OK'),AT(57,3,30,10),USE(?OK)

        END

CODE

Sound=INIMgr.Fetch('Preferences','Sound')   !return 'Sound', no default

 OPEN(PWindow)

INIMgr.Fetch('Preferences',PWindow)         !restore PWindow size & position

 

See Also:     Update