(moving to pd-dev...)
On Wed, Sep 28, 2011 at 01:38:54AM -0400, Mathieu Bouchard wrote:
>> So, if I understand correctly, you are suggesting that these key bindings
>> would only take effect while actively editing the text of an Object, Message,
>> or Comment. If that's the case, +1 -- I agree.
>
> Yes, that's it.
Fortunately, Object, Message and Comment all share the same underlying text
entry box implementation, with controls in src/pdtk_text.tcl.
This patch below seems like it ought to at least do something. The "bind"
call succeeds, because I've checked and the script fires at each <Return>, and
I've looked at other invocations of pdtk_text_editing and these arguments seem
correct.
It doesn't work yet, though, and I'm not sure why not -- pdtk_text_editing
runs to completion, but running it doesn't seem to accomplish anything.
I'll try again later.
Marvin Humphrey
--- a/tcl/pdtk_text.tcl
+++ b/tcl/pdtk_text.tcl
@@ -11,6 +11,7 @@ proc pdtk_text_new {tkcanvas tags x y text font_size color} {
set mytag [lindex $tags 0]
$tkcanvas bind $mytag <Home> "$tkcanvas icursor $mytag 0"
$tkcanvas bind $mytag <End> "$tkcanvas icursor $mytag end"
+ $tkcanvas bind $mytag <Return> "pdtk_text_editing [winfo toplevel $tkcanvas] $mytag 0"
# select all
$tkcanvas bind $mytag <Triple-ButtonRelease-1> \
"pdtk_text_selectall $tkcanvas $mytag"