2002-04-26 05:16:26 -07:00
|
|
|
##ifdef CAMLTK
|
|
|
|
|
|
|
|
open Protocol;;
|
|
|
|
(* Implementation of the tk_optionMenu *)
|
|
|
|
|
|
|
|
let create ?name parent variable values =
|
|
|
|
let w = Widget.new_atom "menubutton" ~parent ?name in
|
|
|
|
let mw = Widget.new_atom "menu" ~parent:w ~name:"menu" in
|
|
|
|
let res =
|
|
|
|
tkEval [|TkToken "tk_optionMenu";
|
|
|
|
TkToken (Widget.name w);
|
|
|
|
cCAMLtoTKtextVariable variable;
|
2002-07-23 07:12:03 -07:00
|
|
|
TkTokenList (List.map (function x -> TkToken x) values)|] in
|
2002-04-26 05:16:26 -07:00
|
|
|
if res <> Widget.name mw then
|
|
|
|
raise (TkError "internal error in Optionmenu.create")
|
|
|
|
else
|
|
|
|
w,mw
|
|
|
|
;;
|
|
|
|
|
|
|
|
let create_named parent name variable values =
|
|
|
|
let w = Widget.new_atom "menubutton" ~parent ~name in
|
|
|
|
let mw = Widget.new_atom "menu" ~parent:w ~name: "menu" in
|
|
|
|
let res =
|
|
|
|
tkEval [|TkToken "tk_optionMenu";
|
|
|
|
TkToken (Widget.name w);
|
|
|
|
cCAMLtoTKtextVariable variable;
|
2002-07-23 07:12:03 -07:00
|
|
|
TkTokenList (List.map (function x -> TkToken x) values)|] in
|
2002-04-26 05:16:26 -07:00
|
|
|
if res <> Widget.name mw then
|
|
|
|
raise (TkError "internal error in Optionmenu.create")
|
|
|
|
else
|
|
|
|
w,mw
|
|
|
|
;;
|
|
|
|
|
|
|
|
##else
|
|
|
|
|
|
|
|
open Protocol;;
|
1999-11-30 06:59:39 -08:00
|
|
|
(* Implementation of the tk_optionMenu *)
|
|
|
|
|
2000-04-11 20:43:25 -07:00
|
|
|
let create ~parent ~variable ?name values =
|
|
|
|
let w = Widget.new_atom "menubutton" ~parent ?name in
|
|
|
|
let mw = Widget.new_atom "menu" ~parent:w ~name:"menu" in
|
1999-11-30 06:59:39 -08:00
|
|
|
(* assumes .menu naming *)
|
|
|
|
let res =
|
2002-04-26 05:16:26 -07:00
|
|
|
tkEval [|TkToken "tk_optionMenu";
|
|
|
|
TkToken (Widget.name w);
|
|
|
|
cCAMLtoTKtextVariable variable;
|
|
|
|
TkTokenList (List.map ~f:(fun x -> TkToken x) values)|] in
|
|
|
|
if res <> Widget.name mw then
|
|
|
|
raise (TkError "internal error in Optionmenu.create")
|
|
|
|
else
|
|
|
|
w, mw
|
|
|
|
;;
|
|
|
|
|
|
|
|
##endif
|