Functions
The Charms API contains the following functions, which are part of the kony.application Namespace.

This API enables you to create a Charm settings menu for an application.
Syntax
kony.applicationcreateSettingsMenu (id, menuSettings);
Input Parameters
Example
//To create a Charm settings menu, enter the following
var settingsMenuItem1 = { id: "about", text: "About" }; var settingsMenuItem2 = { id: "help", text: "Help" }; var settingsMenu = [settingsMenuItem1, settingsMenuItem2]; kony.application.createSettingsMenu("mysettingsmenu", settingsMenu);
Return Values
None.
Special Considerations
If a Charm setting menu is already created with the identifier passed, a new Charm setting menu will be created and the old Charm setting menu will be replaced with the new one. The same holds true for menu items as well.
At least one menu item must be present in the Charm settings menu created. A Charm settings menu with no menu items is invalid.
Platform Availability
- Windows

This method uses the unique identifier which represents the Charm settings menu and sets it as current settings menu. There can be only one current settings menu that can be set any time. Calling this method multiple times, replaces the current Charm settings menu.
Syntax
kony.application.setCurrentSettingsMenu(id);
Input Parameters
Parameter | Description |
---|---|
id [String] - Mandatory | Identifier of the Charm setting menu to be set. |
Example
//To create a Charm settings menu, enter the following
kony.application.setCurrentSettingsMenu("myMenu");
Return Values
None
Platform Availability
- Windows

This method returns the unique identifier of the current menu that is set through getCurrentSettingsMenu.
Syntax
kony.application.getCurrentSettingsMenu();
Input Parameters
None
Example
//To get the unique identifier a Charm settings menu, enter the following
kony.application.getCurrentSettingsMenu(); //Alert the Current Charm Settings menu alert("Current charm menu id is: " + currCharmMenuId);
Return Values
Return value | Description |
---|---|
Unique Identifier | Identifier of the Charm setting menu to be set. |
Platform Availability
- Windows

This API enables you to add a menu item at a given index in the Charm settings menu.
Syntax
kony.application.addSettingsMenuItemAt (id, index, menuSettings);
Input Parameters
Example
To add a menu item at a given index, enter the following:
/*The below function is the callback function for onClickClosure event of app menu item with id "appmenuitemid3".*/ function onClickClosure3() { //proceed with the logic } var settingsMenuItem1 = { id: "about", text: "About", onClick: onClickClosure3 }; //Adding the above app menu item at the index 3. kony.application.addSettingsMenuItemAt("accountMenu", 3, settingsMenuItem1);*
Return Values
None.
Platform Availability
- Windows

This API enables you to removes the specified App Menu item based on the index.
Syntax
kony.application.removeSettingsMenuItemAt (id, index);
Input Parameters
Example
To remove a menu item from a given index, enter the following:
//Removing a menu item from the index 3. kony.application.removeSettingsMenuItemAt("charmmenu", 3);
Return Values
None
Platform Availability
- Windows