summaryrefslogtreecommitdiff
path: root/otherlibs/labltk/builtin/optionmenu.ml
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/labltk/builtin/optionmenu.ml')
-rw-r--r--otherlibs/labltk/builtin/optionmenu.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/otherlibs/labltk/builtin/optionmenu.ml b/otherlibs/labltk/builtin/optionmenu.ml
new file mode 100644
index 0000000000..d3b471859a
--- /dev/null
+++ b/otherlibs/labltk/builtin/optionmenu.ml
@@ -0,0 +1,16 @@
+open Protocol
+(* Implementation of the tk_optionMenu *)
+
+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
+ (* assumes .menu naming *)
+ let res =
+ tkEval [|TkToken "tk_optionMenu";
+ TkToken (Widget.name w);
+ cCAMLtoTKtextVariable variable;
+ TkTokenList (List.map fun:(fun x -> TkToken x) values)|] in
+ if res <> Widget.name mw then
+ raise (TkError "internal error in Optionmenu.create")
+ else
+ w,mw