GLX Application Framework > GLX Application Framework > Configuring Preferences For Your Application

Configuring Preferences For Your Application

The GLX framework will store default values for preferences and broadcast messages when a preference value is changed. Be aware that if you do not want to set a default value or do not need to send a custom message when a preference values is changed then there is no need to add the preference as described in this lesson. You can just use the preference API calls to get/set values.

Overview

1) This field lists preferences that you want to assign a default value to or broadcast messages for.

2) The default value of a preference will be returned if the preference has not yet been assigned a value on the end users computer through a call to glxapp_setPref.

3) You can assign object references and a messages to be sent whenever a preference is updated by a call to glxapp_setPref.

Adding a Preference

1) Click on the Add Preference button.
2) Enter the name of the preference.
3) Click OK.

Note: You only need to add preferences that you want to a) enter a default value for and/or b) broadcast a message for when the value is changed.

Assigning a Default Value

Enter the value in the default value field.

Adding a Message To Broadcast

First you enter the object to send the message to.

1) Click on Add Message.
2) Enter an object reference.
3) Click OK.

Next you enter the message to send to the object.

1) Enter the message name.
2) Press OK.

Handling the Message

You now need to handle the message that is broadcast to the object (or elsewhere in the message path). Add a message with the same name you entered previously and define a single parameter which will be the name of the preference.

Comments (2)

Sunday Apr 06 at 02:52 PM Mark Rauterkus

Can TWO different sets of PREFERENCES be added in an application?

Could be PREFERENCE #1 as NATION. i.e. USA, UK, Canada

Preference #2 could be Sport. i.e., swimming, diving, water polo.

Prefernece #3 could be Challenge. i.e., EASY. Medium, Hard.

etc.

Monday Apr 07 at 01:21 AM Trevor DeVore

You can't have different sets of preferences but you can have multiple preferences which seems to be what you are asking about. Using your examples you could get/set the preferences as follows:

glxapp_setPref "nation", "usa"
glxapp_setPref "sport", "swimming"
glxapp_setPref "challenge", "easy"

put glxapp_getPref("nation") into theNation
put glxapp_getPref("sport") into theSport
put glxapp_getPref("challenge") into theChallenge

Add your comment




E-Mail me when someone replies to this comment

Are you human?