Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
LablTk error
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-23 (15:18)
From: Matt Gushee <mgushee@h...>
Subject: LablTk error
Hello, all--

It was brought to my attention the other day that the Tk Text widget now 
has an undo/redo feature, which is not yet supported by LablTk. Having 
done this sort of thing before, I thought I'd try to patch the OCaml 
source code to add the new feature.

I added the following to the Text widget section of 

   option AutoSeparators ["-autoseparators"; bool]
   option MaxUndo ["-maxundo"; int]
   option Undo ["-undo"; bool]
   function () edit_modified [widget(text); "edit"; "modified"; \
	state: bool]
   function (bool) edit_modified_get [widget(text); "edit"; "modified"]
   function () edit_redo [widget(text); "edit"; "redo"]
   function () edit_reset [widget(text); "edit"; "reset"]
   function () edit_separator [widget(text); "edit"; "separator"]
   function () edit_undo [widget(text); "edit"; "undo"]

I thought this would be sufficient, since there is no apparent reason to 
maintain data related to this functionality on the OCaml side. But 
something is not quite right. After compiling and installing the patched 
OCaml, I started trying to test the new feature. But the new command

   Text.edit_modified_get textwin


   Uncaught exception: Invalid_argument("cTKtoCAMLbool")

So, to find out what the invalid argument was, I tried a direct command 
to Tk:

   tkEval [|tkToken ".t1"; tkToken "edit"; tkToken "modified"|]

which resulted in


The problem is not an incorrect widget name or an unrecognized command: 
those produce different errors. And the equivalent Tcl command

   .t1 edit modified

works as expected in wish on the same machine. So why would Tk return an 
empty string? Thanks in advance for any clues to this mystery.

Matt Gushee
Englewood, CO, USA