EDOBE XDOM TAKE 6 IR - PRODUCTSHEET Especificações Página 81

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 304
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 80
CHAPTER 4: User-Interface Tools Defining behavior with event callbacks and listeners 81
X
Button, RadioButton, and Checkbox controls generate events when the user clicks within the control
bounds. To handle the event, define a callback function for onClick
.
X EditText, Scrollbar, and Slider controls generate events when the content or value changes—that is,
when the user types into an edit field, or moves the scroll or slider indicator. To handle these events,
define callback functions for onChange
and onChanging.
X ListBox, DropDownList, and TreeView controls generate events whenever the selection in the list
changes. To handle the event, define a callback function for onChange
. The TreeView control also
generates events when the user expands or collapses a node, handled by the onExpand
and
onCollapse
callback functions.
X The ListBox also generates an event when the user double-clicks an item. To handle it, define a
callback function for the onDoubleClick
event.
X Both containers and controls generate events just before they are drawn, that allow you to customize
their appearance. To handle these events, define callback functions for onDraw
. Your handler can
modify or control how the container or control is drawn using the methods defined in the control’s
associated ScriptUIGraphics object
.
X In Windows only, you can register a key sequence as a shortcutKey for a window or for most types of
controls. To handle the key sequence, define a callback function for onShortcutKey
in that control.
Defining event-handler callback functions
Your script can define an event handler as a named function referenced by the callback property, or as an
unnamed function defined inline in the callback property.
X If you define a named function, assign its name as the value of the corresponding callback property.
For example:
function hasBtnsCbOnClick() { /* do something interesting */ }
hasBtnsCb.onClick = hasBtnsCbOnClick;
X For a simple, unnamed function, set the property value directly to the function definition:
UI-element.callback-name = function () { handler-definition};
Event-handler functions take no arguments.
For example, the following sets the
onClick property of the hasBtnsCb checkbox to a function that
enables another control in the same dialog:
hasBtnsCb.onClick = function ()
{ this.parent.alertBtnsPnl.enabled = this.value; };
The following statements set the onClick event handlers for buttons that close the containing dialog,
returning different values to the
show method that invoked the dialog, so the calling script can tell which
button was clicked:
buildBtn.onClick = function () { this.parent.parent.close(1); };
cancelBtn.onClick = function () { this.parent.parent.close(2); };
Vista de página 80
1 2 ... 76 77 78 79 80 81 82 83 84 85 86 ... 303 304

Comentários a estes Manuais

Sem comentários