Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: wester@ilt.fhg.de
To: caml-list@inria.fr
Subject: Re: LablTk problem
Date: Mon, 5 Feb 2001 09:20:27 +0100	[thread overview]
Message-ID: <200102050820.JAA19345@ilt.fhg.de> (raw)
In-Reply-To: <200102021537.QAA13795@ilt.fhg.de>

Rolf Wester (that's me) wrote:

> Hi,
> 
> I want to make a little Tk application. I have a main frame, a 
> menu frame with a menu button, a menu and a menu command.
> Within the menu frame there is also a button. Besides this I have 
> a canvas. The button works, when pressing it, the application exits.
> But the menu command doesn't react at all. I also tried the demo.ml
> program in the otherlibs\labltk\example directory. Here the menu 
> command doesn't work too. I run an ocamltop with libltk.cma linked in
> under WindowsNT. 
> 
> I would be very appreciative for help.
> 
> With kind regards.
> 
> Rolf Wester
> 
> ------------------------------------------------------------------------------------------------------------
> 
> #directory "h:\programme\ocaml30\lib\labltk";;
> #labels true;;
> 
> let mainWindow () =
>   let top = Tk.openTk() in
> 
>   let menuFrame   = Frame.create top ~width: 20 ~height: 20 ~background: `Red in
> 	Tk.pack ~side: `Top  ~fill: `X   [menuFrame];
> 
>   let fileButton  = Menubutton.create menuFrame ~text:"File"  ~borderwidth:3  ~relief: `Groove in 
> 	Tk.pack ~side: `Left [fileButton];
>   let fileMenu    = Menu.create fileButton in
>     Menu.add_command  fileMenu ~label:"Exit..." ~command: (fun () -> closeTk ();); 
> 
>   let exitButton = Button.create  menuFrame ~text: "Exit"  ~borderwidth:3 ~relief: `Ridge in
> 	Tk.pack ~side: `Right [exitButton];
> 	bind  ~events:[`ButtonPress] ~action: (fun ev -> closeTk ();) exitButton; 
> 
>   let canvas      = Canvas.create top ~width: 600 ~height: 400 ~background: `White in
> 	Tk.pack [canvas];
> 	canvas;;
> 
> let canvas = mainWindow ();;
> Tk.mainLoop ();;
> 
Sorry it was my fault, I found the problem. I simplified things a 
little bit in the above example. The program as it is works fine. 
But when I was testing the program I made the following:

Thread.start Tk.mainLoop();;

And now the menus don't work any more. What I want to do is start 
a Tk application in it's own thread and  be able to draw to the canvas 
interactively  at the sam time. If I press one the simple buttons the 
application stops, only the menus don't work.

Rolf 
-------------------------------------
Rolf Wester
wester@ilt.fhg.de



  reply	other threads:[~2001-02-05 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-02 15:37 wester
2001-02-05  8:20 ` wester [this message]
2001-02-06  1:22   ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200102050820.JAA19345@ilt.fhg.de \
    --to=wester@ilt.fhg.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox