BBjWebEventOptions::setDebounce

Description

In BBj 24.00 and higher, this setting debounces the client-side BBjWebComponent event handler to the specified delay in milliseconds.

Syntax

Return Value Method
BBjWebEventOptions setDebounce(int delay, boolean leading, boolean trailing)

Parameters

Parameter Description
delay The debounce delay in milliseconds.
leading A boolean value that specifies whether the debounced event should be reported to the server immediately.
trailing A boolean value that specifies whether the debounced event should be deferred to the end of the specified delay.

Return Value

Returns a reference to the BBjWebEventOptions object.

Remarks

By default, BBjWebComponent BBjWebEvents are reported to the server immediately. This setting debounces the client-side BBjWebComponent event handler to the specified delay in milliseconds.

Example

rem ' BBjWebComponent Debounce & Throttle

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,300,300,"Debounce & Throttle",$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")

button! = window!.addWebComponent(101,25,25,250,25,"button")
button!.setText("Click Immediate")
button!.setAttribute("title","Click events are reported immediately")
button!.setCallback("click","event")
options! = button!.newEventOptions()
options!.setImmediate(); rem ' this is the default
System.out.println("getImmediate = " + Boolean.toString(options!.getImmediate()))

throttle! = window!.addWebComponent(102,25,75,250,25,"button")
throttle!.setText("Click Throttle")
options! = throttle!.newEventOptions()
options!.setThrottle(1000)
throttle!.setAttribute("title","Click events are throttled to once per second.")
throttle!.setCallback("click","event",options!)
System.out.println("getThrottle = " + Boolean.toString(options!.getThrottle()))
System.out.println("getDelay = " + str(options!.getDelay()))

debounce! = window!.addWebComponent(103,25,125,250,25,"button")
debounce!.setText("Click Debounce")
options! = debounce!.newEventOptions()
options!.setDebounce(1000,Boolean.TRUE,Boolean.FALSE)
debounce!.setAttribute("title","Click events are debounced to once per second.")
debounce!.setCallback("click","event",options!)
System.out.println("getDebounce = " + Boolean.toString(options!.getDebounce()))
System.out.println("getDelay = " + str(options!.getDelay()))
System.out.println("getLeading = " + Boolean.toString(options!.getLeading()))
System.out.println("getTrailing = " + Boolean.toString(options!.getTrailing()))

status! = window!.addStatusBar(99)

process_events

eoj:
  release

event:
  event! = sysgui!.getLastEvent()
  msg$ = date(0:"%Hz:%mz:%sz.%tz")
  msg$ = msg$ + " " + event!.getEventType()
  msg$ = msg$ + " " + event!.getControl().getText()
  status!.setText(msg$)
  System.out.println(msg$)
return

ClosedVersion History

  • BBj 24.00: BBjWebEventOptions::setDebounce added.

See Also

BBjAPI

Object Variables

PROCESS_EVENTS Verb

BBjWebComponent::setCallback

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.