2000-04-12 18:11:06 -07:00
|
|
|
let bind ~events
|
2000-04-11 20:43:25 -07:00
|
|
|
?(extend = false) ?(breakable = false) ?(fields = [])
|
2000-04-12 18:11:06 -07:00
|
|
|
?action widget tag =
|
2000-02-15 02:10:26 -08:00
|
|
|
tkCommand
|
|
|
|
[| cCAMLtoTKwidget widget;
|
|
|
|
TkToken "bind";
|
|
|
|
cCAMLtoTKtagOrId tag;
|
|
|
|
cCAMLtoTKeventSequence events;
|
|
|
|
begin match action with None -> TkToken ""
|
|
|
|
| Some f ->
|
|
|
|
let cbId =
|
2000-04-11 20:43:25 -07:00
|
|
|
register_callback widget ~callback: (wrapeventInfo f fields) in
|
2000-02-15 02:10:26 -08:00
|
|
|
let cb = if extend then "+camlcb " else "camlcb " in
|
|
|
|
let cb = cb ^ cbId ^ writeeventField fields in
|
|
|
|
let cb =
|
|
|
|
if breakable then
|
|
|
|
cb ^ " ; if { $BreakBindingsSequence == 1 } then { break ;}"
|
|
|
|
^ " ; set BreakBindingsSequence 0"
|
|
|
|
else cb in
|
|
|
|
TkToken cb
|
|
|
|
end
|
|
|
|
|]
|