12345678910111213141516171819202122232425(** Handling current selection.
Current selection is retrieved using {!val-get}. For widgets
handling user selection, when the user selects something,
the widget will {!val-set} the function called to retrieve the selection.
{!val-unset} removes the selection function.
*)(**/**)letselection=ref(None:(unit->stringoption)option)(**/**)letunset()=selection:=Noneletsetf=selection:=Somef;Log.debug(funm->m"Selection set")letget()=match!selectionwith|None->None|Somef->tryf()withe->Log.err(funm->m"Selection.get: %s"(Printexc.to_stringe));unset();None