DwtButton

Zimbra AjaxTk->DHTML Widget Toolkit->Widgets


Preview

DwtButton.JPG

Usage

function createButton(name){

   var l = new AjxListener(null, buttonListener);
   var b = new DwtButton(shell);
   b.addSelectionListener(l);
   b.setText(name);

}


function buttonListener(ev) {

   alert("Button Pressed: " + ev.item.getText());

}


Methods

DwtButton(parent, style, className, posStyle, actionTiming)

This class represents a button, which is basically a smart label that can handle various UI events. It knows when it has been activated (the mouse is over it), when it has been triggered (mouse down), and when it has been pressed (mouse up). In addition to a label's image and/or text, a button may have a dropdown menu.

parent
the parent widget
style
the label style (see DwtLabel)
className
a CSS class for look and feel, defaults to "DwtButton" class
posStyle
HTML positioning style - Static, Absolute, Relative
actionTiming
Sets whether actions for this button should occur on mouse up or mouse down

setMenu(menuOrCallback, shouldToggle, followIconStyle)

Adds a dropdown menu to the button, available through a small down-arrow.

menuOrCallback
The dropdown menu or an AjxCallback object. If a callback is given, it is called the first time the menu is requested. The callback must return a valid DwtMenu object.
shouldToggle
followIconStyle
style of menu item (should be checked or radio style) for which the button icon should reflect the menu item icon

addSelectionListener(listener)

removeSelectionListener(listener)

Removes a selection listener.

listener
the listener to remove

removeSelectionListeners()

Removes all the selection listeners.


addDropDownSelectionListener(listener)

Adds a listener to be notified when the dropdown arrow is pressed.

listener
a listener

removeDropDownSelectionListener(listener)

Removes a dropdown selection listener.

listener
the listener to remove

setDropDownImages(enabledImg, disImg, hovImg, depImg)

setEnabled(enabled)

Sets the enabled/disabled state of the button. A disabled button may have a different image, and greyed out text. The button (and its menu) will only have listeners if it is enabled.

enabled
whether to enable the button

setHoverImage(hoverImageInfo)

hoverImageInfo

setMenu(menuOrCallback, shouldToggle, followIconStyle) Adds a dropdown menu to the button, available through a small down-arrow.

menuOrCallback
The dropdown menu or an AjxCallback object. If a callback is given, it is called the first time the menu is requested. The callback must return a valid DwtMenu object.
shouldToggle
followIconStyle
style of menu item (should be checked or radio style) for which the button icon should reflect the menu item icon


getMenu() Returns the button's menu

resetClassName() Returns the button display to normal (not activated or triggered).

setActionTiming(actionTiming) Sets whether actions for this button should occur on mouse up or mouse down.

actionTiming
Currently supports DwtButton.ACTION_MOUSEDOWN and DwtButton.ACTION_MOUSEUP

setActivated(activated) Activates/inactivates the button. A button is activated when the mouse is over it.

activated
whether the button is activated

setEnabledImage(imageInfo)

imageInfo

setDepressedImage(imageInfo)

setToggled(toggled)

isToggled()

popup()


trigger() deactivate()


Verified Against: unknown Date Created: 4/15/2006
Article ID: https://wiki.zimbra.com/index.php?title=DwtButton Date Modified: 2015-03-24



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search