caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* labltk bind ~events list questions/bugs?
@ 2000-12-27  8:01 Chris Hecker
  2000-12-31  7:51 ` Jacques Garrigue
  2000-12-31 20:25 ` John Max Skaller
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Hecker @ 2000-12-27  8:01 UTC (permalink / raw)
  To: caml-list


Hi, a few labltk questions:

1. Does the ~events list passed to Tk.bind mean the callback should get all of those events?  I can't think of what else it's for, but it doesn't seem to work correctly.  I only get one of the types, or sometimes none.  This is on Win98 with tcl/tk 8.3.

Here's some example code:

open Tk

let _ =
  let top = openTk () in
  Wm.title_set top "Simple OCaml Tk App";
  Toplevel.configure top ~height:200 ~width:200;
  print_string "\n";
  bind top ~events:[`KeyPress;`ButtonPress] 
    ~fields:[`KeySymString;`Type;`Detail]
    ~action:(fun ev -> Printf.printf "%s %d %s\n"
        ev.ev_KeySymString ev.ev_Type ev.ev_Detail
            );
  Printexc.print mainLoop ()

If I bind the list separately it seems to work, but I haven't tested it thoroughly.
    
2. As another question, if I have ~events:[`Modified ([`Shift],`KeyPress)], sometimes I just get the keys that were pressed when the shift key was down, sometimes I get a zillion Shift_L events, and sometimes I get nothing.

3. I'd like to be able to distribute an executable compiled with labltk and lablgl without having people have to have tcl/tk installed.  Has anybody successfully statically linked tk into an ocaml app?  Perl/Tk is set up such that it doesn't depend on the tcl/tk distribution, so I assume this is possible.  Would it be a ton of work?

Chris



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: labltk bind ~events list questions/bugs?
  2000-12-27  8:01 labltk bind ~events list questions/bugs? Chris Hecker
@ 2000-12-31  7:51 ` Jacques Garrigue
  2001-01-03  0:07   ` John Max Skaller
  2000-12-31 20:25 ` John Max Skaller
  1 sibling, 1 reply; 5+ messages in thread
From: Jacques Garrigue @ 2000-12-31  7:51 UTC (permalink / raw)
  To: checker; +Cc: caml-list

From: Chris Hecker <checker@d6.com>

> Hi, a few labltk questions:
> 
> 1. Does the ~events list passed to Tk.bind mean the callback should
> get all of those events?  I can't think of what else it's for, but
> it doesn't seem to work correctly.  I only get one of the types, or
> sometimes none.  This is on Win98 with tcl/tk 8.3.

When in doubt, you should read the Tk man page.
In this case, it tells you that you can bind a _sequence_ of events.
So this is not an "or", the callback is only called if all these
events happen, and in that precise order.

> 2. As another question, if I have ~events:[`Modified
> ([`Shift],`KeyPress)], sometimes I just get the keys that were pressed
> when the shift key was down, sometimes I get a zillion Shift_L events,
> and sometimes I get nothing.

Stranger. This should be only the first case. At least, this is how it
works on X11.

> 3. I'd like to be able to distribute an executable compiled with
> labltk and lablgl without having people have to have tcl/tk installed.
> Has anybody successfully statically linked tk into an ocaml app?
> Perl/Tk is set up such that it doesn't depend on the tcl/tk
> distribution, so I assume this is possible.  Would it be a ton of
> work? 

Somebody on this list explained a while ago (around april 2000?) how
one could theoretically put in the linked binary the tcl source code
needed by the interpreter to boot. Since Labltk requires the tcl
interpreter to run (contrary to PerlTk, I believe), this would
probably be the way to go. But I have no precise idea on how to do it,
and how much code you must link in.

If you really need to distribute statically linked versions of your
code, you might wish to look at lablgtk. Unison moved to it partly
because of that, and also because it allows you to create a better
finished product than labltk.

Best wishes,

     Jacques
---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: labltk bind ~events list questions/bugs?
  2000-12-27  8:01 labltk bind ~events list questions/bugs? Chris Hecker
  2000-12-31  7:51 ` Jacques Garrigue
@ 2000-12-31 20:25 ` John Max Skaller
  2001-01-03 14:29   ` Vladimir Vyskocil
  1 sibling, 1 reply; 5+ messages in thread
From: John Max Skaller @ 2000-12-31 20:25 UTC (permalink / raw)
  To: Chris Hecker; +Cc: caml-list

Chris Hecker wrote:

> 3. I'd like to be able to distribute an executable compiled with labltk and lablgl without having people have to have tcl/tk installed.  Has anybody successfully statically linked tk into an ocaml app?  Perl/Tk is set up such that it doesn't depend on the tcl/tk distribution, so I assume this is possible.  Would it be a ton of work?

AFAIK: Perl must be clever: Tcl and Tk require directories with 
(script) files on disk to operate: statically linking the binary isn't
enough.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: labltk bind ~events list questions/bugs?
  2000-12-31  7:51 ` Jacques Garrigue
@ 2001-01-03  0:07   ` John Max Skaller
  0 siblings, 0 replies; 5+ messages in thread
From: John Max Skaller @ 2001-01-03  0:07 UTC (permalink / raw)
  To: Jacques Garrigue; +Cc: checker, caml-list

Jacques Garrigue wrote:
> 
> From: Chris Hecker <checker@d6.com>
 
> > 2. As another question, if I have ~events:[`Modified
> > ([`Shift],`KeyPress)], sometimes I just get the keys that were pressed
> > when the shift key was down, sometimes I get a zillion Shift_L events,
> > and sometimes I get nothing.
> 
> Stranger. This should be only the first case. At least, this is how it
> works on X11.

	Here's my guess: this is a 'quirk' of the PC keyboard firmware.
It is a serious problem for game design. What happens is that
when there are NO keys pressed, and you press any repeating key,
you get a sequence of KEY_DOWN tokens from the keyboard.
If you then press another key, the auto-repeat is switched OFF
for the first key, and on for the second key. If you release
the second key, the first doesn't auto-repeat: 

	11111111111111122222222222222
        ^ press 1  ....^ press 2     ^ release 2  ^ release 1

	aaaaaaaaaaaaaaaaa
	^ press a        ^ press shift


	The _only_ solution is to reprogram the keyboard CPU.
The whole thing is a stupid hangover from DOS: the keyboard
should just send keyup/keydown tokens, and let the OS driver
handle repeats and timing.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: labltk bind ~events list questions/bugs?
  2000-12-31 20:25 ` John Max Skaller
@ 2001-01-03 14:29   ` Vladimir Vyskocil
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Vyskocil @ 2001-01-03 14:29 UTC (permalink / raw)
  To: caml-list

John Max Skaller wrote:

> Chris Hecker wrote:
> 
>> 3. I'd like to be able to distribute an executable compiled with labltk and lablgl without having people have to have tcl/tk installed.  Has anybody successfully statically linked tk into an ocaml app?  Perl/Tk is set up such that it doesn't depend on the tcl/tk distribution, so I assume this is possible.  Would it be a ton of work?
> 
> 
> AFAIK: Perl must be clever: Tcl and Tk require directories with 
> (script) files on disk to operate: statically linking the binary isn't
> enough.


I had the same problem which I solved by merging all the tcl/tk 
libraries files (written in
TCL) into one big file then I converted this file to "C" code (one big 
string which was evaluated
by the Tcl_Eval function) and this code was linked to Caml.

-- 
Vyskocil Vladimir
Ingenieur Systeme - Unite Systeme & Securite IP
Rightvision - The Internet Appliance Company
e-mail: vladimir.vyskocil@rightvision.com



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-01-04 13:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-27  8:01 labltk bind ~events list questions/bugs? Chris Hecker
2000-12-31  7:51 ` Jacques Garrigue
2001-01-03  0:07   ` John Max Skaller
2000-12-31 20:25 ` John Max Skaller
2001-01-03 14:29   ` Vladimir Vyskocil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).