-let set_selection mathview () =
- let module O = Ominidom in
- begin
- match mathview#get_selection with
- | Some node ->
- begin
- try
- let parent_node = node#get_parent in
- mathview#set_selection (Some parent_node);
- print_string "set selection: SEEMS TO WORK\n"
- with
- _ -> print_string "EXCEPTION: no parent\n"
- end
+let set_selection (mathview : GMathView.math_view) () =
+ begin
+ match mathview#get_selection with
+ Some element ->
+ begin
+ match element#get_parentNode with
+ Some p ->
+ begin
+ try
+ mathview#set_selection (Some (new Gdome.element_of_node p));
+ print_string "set selection: SEEMS TO WORK\n"
+ with
+ GdomeInit.DOMCastException _ ->
+ print_string "EXCEPTION: no parent\n"
+ end
+ | None -> assert false (* every element has a parent *)
+ end