Interface MultiSourceEvent::getButton
Description
In BBj 7.0 and higher, this method calls SysGuiEvent::getControl() and casts the return value to a BBjButton.
Syntax
Return Value |
Method |
getButton() |
Parameters
None.
Return Value
Returns the BBjButton that is the source of the event.
Remarks
If the source of the event is not a BBjButton, then this method will throw an !ERROR=26.
Example
open(unt)"X0"
sg!=BBjAPI().getSysGui()
win! = sg!.addWindow(10,10,300,300,"")
cedit! = win!.addCEdit(101, 10,10,80,140,"cedit")
button! = win!.addButton(102, 10,210,80,40,"button")
handler! = new EventHandler()
cedit!.setCallback(cedit!.ON_GAINED_FOCUS, handler!, "handleEvent")
button!.setCallback(button!.ON_GAINED_FOCUS, handler!, "handleEvent")
process_events
class public EventHandler
field public BBjControl control!
method public void handleEvent(MultiSourceEvent event!)
#control! = event!.getCEdit(err = getButton)
print "CEdit received focus"
methodret
getButton:
#control! = event!.getButton(err = getWindow)
print "button received focus"
methodret
getWindow:
#control! = event!.getTopLevelWindow()
print "window received focus"
methodret
methodend
classend
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.