+ let queries = ["Locate";"Hint";"Match";"Elim";"Instance"] in
+ let combo,_ = GEdit.combo_box_text ~strings:queries () in
+ let activate_combo_query input q =
+ let q' = String.lowercase q in
+ let rec aux i = function
+ | [] -> failwith ("Whelp query '" ^ q ^ "' not found")
+ | h::_ when String.lowercase h = q' -> i
+ | _::tl -> aux (i+1) tl
+ in
+ combo#set_active (aux 0 queries);
+ win#queryInputText#set_text input
+ in
+ let set_whelp_query txt =
+ let query, arg =
+ try
+ let q = Pcre.extract ~rex:whelp_query_RE txt in
+ q.(1), q.(2)
+ with Invalid_argument _ -> failwith "Malformed Whelp query"
+ in
+ activate_combo_query arg query
+ in