Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Button

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: User:Kbwiki (11 Nov 2009)
Last edited: hamishwillee (30 Jul 2012)

Contents

Inheritance

Nokia.Button
|- Nokia.Widget
|- Nokia.Class (basic class)

1 - Description

The traditional Button component.

2 - Visual Design

Button02.png Button01.png Button03.png Button04.png

3 - Component Dependencies

3.1 CSS

<!-- Themeroller CSS -->
<link rel="stylesheet" href="themes/themeroller/<theme>/Themeroller.css" type="text/css" media="screen">
<!-- Specific Theme/Resolution CSS -->
<link rel="stylesheet" href="/themes/nokia/ext-theme/<theme>/<resolution>/custom.css" type="text/css" media="screen">

3.2 Javascript

<!-- jQuery file -->
<script src="/lib/jquery/jQuery.js" type="text/javascript" charset="utf-8"></script>
<!-- Guarana file -->
<script src="/lib/Guarana.js" type="text/javascript" charset="utf-8"></script>

4 - Functional Specifications/Requirements

4.1 - Options:

  • element: 'selector'
    • jQuery selector or the DOM reference to become the container of the component.
  • label: string
    • Label content to be included in the component.
  • disable: boolean
    • Defines whether the component is disabled.
  • keeppressed: boolean
    • Defines whether the component is in keeppressed mode.
  • pressed: boolean
    • Defines whether the component is pressed.
  • roundedCorners: boolean
    • Defines whether the component has rounded corners.
  • width: int
    • Defines the component width.
  • height: int
    • Defines the component height.
  • click: function
    • Defines the called function to click callback.
  • disable: function
    • Defines the called function to disable callback.
  • enable: function
    • Defines the called function to enable callback.
  • press: function
    • Defines the called function to press callback.
  • unpress: function
    • Defines the called function to unpress callback.


4.2 - Events - Callbacks

  • create: function()
    • Scope: [this.element]
  • click: function(event)
    • Scope: [this.element]
  • disable: function(event)
    • Scope: [this.element]
  • enable: function(event)
    • Scope: [this.element]
  • press: function(event)
    • Scope: [this.element]
  • unpress: function(event)
    • Scope: [this.element]


4.3 - Methods

  • enable: function()
    • Enables the button component.
    • return [void]
  • disable: function()
    • Disables the button component.
    • return [void]
  • press: function()
    • Performs the button component press.
    • return [void]
  • unpress: function()
    • Performs the button component unpress.
    • return [void]
  • setLabel: function()
    • Sets a specific label for the button component.
    • return [void]
  • getLabel: function()
    • Returns the component label
    • return [string]
  • setClick: function()
    • Reassign the click function.
    • return [void]

4.4 - Default options

  • element: ",
  • label: ' ',
  • disabled: false,
  • keeppressed: false,
  • pressed: false,
  • roundedCorners: true,
  • width: 'auto',
  • height: 'auto'
  • click: function() {},
  • disable: function() {},
  • enable: function() {},
  • press: function() {},
  • unpress: function() {}

5 - Component Demo

5.1 HTML

<span id="button01" class="btn"></span>

5.2 Javascript

var btn1 = new Nokia.Button({
     element: '#button01',
     disabled: false,
     keeppressed: false,
     label: 'Button 01',
     create: function() {
          //alert('Button: Created');
     },
     click: function() {
          //alert('Button: Click');
     }
});

6 - Nokia WRT Browser Compatibility

▴   S60 3.1 S60 3.2 S60 5.0
Button NO  YES  YES 
This page was last modified on 30 July 2012, at 05:05.
49 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×