Difference between revisions of "UserPreference"

From Catglobe Wiki
Jump to: navigation, search
(Replaced content with "Category:Archive")
 
Line 1: Line 1:
{{CGscriptClass_Template
+
[[Category:Archive]]
|Name=UserPreference
 
|Description=A user preference
 
|Constructors=
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=navName|Description=Navigation access value was stored with|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=prefType|Description=Unique key for the setting}}
 
|Description=Get existing a new personalized stored value.}}
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=navName|Description=Navigation access to associate the value with|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=prefType|Description=Unique key for the setting|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=value|Description=Value to store}}
 
|Description=Create a new or update existing personalized stored value.}}
 
|Methods=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=Save|Description=Save the current value}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
 
|Properties=
 
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=Value|HasGetter=1|HasSetter=1|Description=Get/Set the current value}}
 
}}
 
 
 
 
 
 
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
 
 
 
<source lang="javascript">
 
//create a new userPreference
 
string navName="Questionnaire_Search";
 
number prefType=1;
 
string value="Hello world";
 
UserPreference pref = new UserPreference(navName, prefType,value);
 
pref.Save();
 
</source>
 
 
 
<br/><source lang="javascript">
 
//Get existing userPreference
 
string navName="Questionnaire_Search";
 
number prefType=1;
 
UserPreference pref = new UserPreference(navName, prefType);
 
print(pref.Value);//return: Hello world
 
 
 
</source>
 
 
 
<br/><source lang="javascript">
 
//Update an existing userPreference
 
string navName="Questionnaire_Search";
 
number prefType=1;
 
string value="abc xyz";
 
UserPreference pref = new UserPreference(navName, prefType, value);
 
pref.Save();
 
print(pref.Value);//return: abc xyz
 
</source>
 

Latest revision as of 09:50, 24 November 2016