From: anoved on
Hi all,

I have a question about using text peer widgets with ctext (from
TKLib). I'm not sure how to create a peer widget that is a ctext
widget - if I start by creating a ctext widget, and use it to create a
peer, the resulting widget is a plain text widget. Here is an example
to reproduce the problem (using ActiveTcl 8.5.8 on OS X 10.6.4):

package require ctext
ctext .a
..a peer create .b
grid .a .b
winfo class .a --> Ctext
winfo class .b --> Text

Any tips, guidance, or corrections would be appreciated. Thanks!

Jim
From: Keith Nash on
Hello Jim,

ctext pre-dates peer widgets. Ideally, one would modify the ctext code to
adapt it to peer widgets. In the meantime, this script works for me (though
I haven't tested all ctext features).

Keith.


package require ctext

rename ctext::linemapUpdate ctext::linemapUpdate1

proc ctext::linemapUpdate {win args} {
linemapUpdate1 $win {*}$args
foreach peer [$win peer names] {
set peerCtext [winfo parent $peer]
linemapUpdate1 $peerCtext {*}$args
}
return
}

proc ctextPeerCreate {win1 win} {
ctext $win
destroy $win.t
$win1 peer create $win.t

# Copied from ctext constructor:

grid $win.t -row 0 -column 1 -sticky news
grid rowconfigure $win 0 -weight 100
grid columnconfigure $win 1 -weight 100

bind $win.t <Configure> [list ctext::linemapUpdate $win]
bind $win.t <KeyRelease-Return> [list ctext::linemapUpdate $win]
rename $win.t $win._t
bindtags $win.t [linsert [bindtags $win.t] 0 $win]
interp alias {} $win.t {} $win

return $win
}

# Demo:

ctext .a
ctextPeerCreate .a .b
grid .a .b

From: Arjen Markus on
On 1 jul, 09:59, Keith Nash <k...(a)citizenearth.com> wrote:
> Hello Jim,
>
> ctext pre-dates peer widgets.  Ideally, one would modify the ctext code to
> adapt it to peer widgets.  In the meantime, this script works for me (though
> I haven't tested all ctext features).
>
> Keith.
>
> package require ctext
>
> rename ctext::linemapUpdate ctext::linemapUpdate1
>
> proc ctext::linemapUpdate {win args} {
>     linemapUpdate1 $win {*}$args
>     foreach peer [$win peer names] {
>         set peerCtext [winfo parent $peer]
>         linemapUpdate1 $peerCtext {*}$args
>     }
>     return
>
> }
>
> proc ctextPeerCreate {win1 win} {
>     ctext $win
>     destroy $win.t
>     $win1 peer create $win.t
>
>     # Copied from ctext constructor:
>
>     grid $win.t -row 0 -column 1 -sticky news
>     grid rowconfigure $win 0 -weight 100
>     grid columnconfigure $win 1 -weight 100
>
>     bind $win.t <Configure> [list ctext::linemapUpdate $win]
>     bind $win.t <KeyRelease-Return> [list ctext::linemapUpdate $win]
>     rename $win.t $win._t
>     bindtags $win.t [linsert [bindtags $win.t] 0 $win]
>     interp alias {} $win.t {} $win
>
>     return $win
>
> }
>
> # Demo:
>
> ctext .a
> ctextPeerCreate .a .b
> grid .a .b

I suggest you report a bug/feature request in the Tcllib/Tklib
project.

Regards,

Arjen
From: Keith Nash on
Arjen Markus wrote:

> I suggest you report a bug/feature request in the Tcllib/Tklib
> project.

Well, it wouldn't be much work to add a "proper" peer command to ctext, and
maybe that would be the best thing to file as a patch/feature request.

I think the last I heard, GPS (author of ctext) was busy with other things,
but it would be nice if development continued in future because ctext is one
of the most useful add-ons ever written.

Keith.

From: Arjen Markus on
On 1 jul, 10:34, Keith Nash <k...(a)citizenearth.com> wrote:
> Arjen Markus wrote:
> > I suggest you report a bug/feature request in the Tcllib/Tklib
> > project.
>
> Well, it wouldn't be much work to add a "proper" peer command to ctext, and
> maybe that would be the best thing to file as a patch/feature request.
>
> I think the last I heard, GPS (author of ctext) was busy with other things,
> but it would be nice if development continued in future because ctext is one
> of the most useful add-ons ever written.
>
> Keith.

Which is why I suggested registering this as a patch/feature request:
it won't disappear then, even if it takes a while to implement it
properly.

Regards,

Arjen