PreferenceGroup()

Syntax

Result = PreferenceGroup(Name$)
Description
Creates a new group (in the form: [Name$]) or changes the current group in the preference file. All following read or write operations will be restricted to this group. To move outside of any groups, an empty 'Name$' can be used.

Parameters

Name$ The new group name.

Return value

Nonzero if the group was already created, zero otherwise.

Example

  ; Open a preference file
  OpenPreferences(#PB_Compiler_Home +"Examples\Sources\Data\test.pref")
  
  ; Select a group
  PreferenceGroup("Window")
  
  ; Examine keys in the group 'Window'
  ExaminePreferenceKeys()
  While  NextPreferenceKey() ; While a key exists
    MessageRequester("Keys from the 'Window' group", PreferenceKeyName() + " = " + PreferenceKeyValue())  ; Display the key with its data
  Wend
  
  ; Close the preference file
  ClosePreferences()  

Remarks

If the group does not exist yet, it will not be created immediately. It will instead be created once the first key is written to it. This allows to use the PreferenceGroup() function to test if a group exists without creating many empty groups.

Supported OS

All

<- PreferenceComment() - Preference Index - PreferenceGroupName() ->