The setMode() Command

setmode.png

Command Summary

Changes one or more mode settings.

Command Syntax

  • setMode(setting,value)
  • setMode({set1,val1,…})

Menu Location

Starting in the program editor:

  • Press F6 to enter the Mode menu.
  • Select the desired setting to enter its submenu.
  • Select the desired value to paste setMode("setting", "value")

Calculator Compatibility

This command works on all calculators.

Token Size

3 bytes

The setMode() command is used, mainly by programmers, to change mode settings (outside a program, of course, you can just select the settings in the MODE menu). When a setting is changed, it returns the old value of the setting. There are two ways to use the command:

  • setMode(setting,value) will change setting to value, and return the old value of setting.
  • setMode({set1,val1,…}) will change set1 to val1, set2 to val2, and so on, for any number of settings, and return a list in the same format of settings and their old values.

The first format is used to change only one setting, and the second to change several settings.

Both settings and values are identified by strings (not case-sensitive). All the strings involved are given in the Table of Mode Settings.

An example of setMode():

setMode("Angle","DEGREE")
           "RADIAN"
setMode({"Angle","RADIAN","Split Screen","FULL"})
           {"Split Screen" "FULL" "Angle" "DEGREE"}

Advanced Uses

Unfortunately, the strings depend on language localization. For compatibility with other languages, there is an alternate identification for the settings and values: you can use a string containing a number identifying the setting or value (see the Table of Mode Settings). This is also shorter.

As an example, the numerical version of the sample code above would be:

setMode("3","2")
           "1"
setMode({"3","1",8","1"})
           {"8" "1" "3" "2"}

Use the output of the list version of setMode() to restore settings to what they were previously:

:setMode({"Angle","RADIAN"})→oldmode
...
:setMode(oldmode)

This works with the numerical or the verbose versions of the command; the output of the command will be in the same format as the input.

Error Conditions

130 - Argument must be a string happens when the data type of arguments is incorrect.

260 - Domain error happens when the string used to identify a setting is incorrect or misspelled.

430 - Invalid for the current mode settings happens when a setting depends on other settings that are incorrect (e.g. setting "Split 2 App" if "Split Screen" is "FULL").

450 - Invalid in a function or current expression happens when setMode() is used in a function.

Related Commands

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.