From: amitmjoshi on
I have an application created using scrolled text widget.
How can i bind the viish bindings to the same scrolled text widget.
The application is created in vTcl using place.

sample code of viish is as follows...

proc Init {} {
upvar #0 argv argv
if {[winfo children .]==""} {
if {![winfo exists .t]} {
# demo mode
wm title . TkVIish
set ::sym::TopLevelFileCommands(.t) 1
foreach i $argv {
if {[file readable $i]} {
::sym::fs::defLoadFile .t "e
$i"
break
}
}
text .t -yscrollcommand {.s set} -font $::fspc
scrollbar .s -command {.t yview}
text .e -state disabled -font $::fspc_sm -
height 1
pack .e -side bottom -expand true -fill x
pack .s -side right -expand true -fill y
pack .t -side left -expand true -fill both
focus -force .t
::sym::symkeys .t .e
::sym::initfi .t
}
}
}


Init

http://www.geocities.com/m_schrumpf/tcl/viish.tgz


Melissa can you please help me out as you wrote the code of this viish.
From: rf on
On 23 Jun., 12:26, "amitmjo...(a)gmail.com" <amitmjo...(a)gmail.com>
wrote:
> I have an application created using scrolled text widget.
> How can i bind the viish bindings to the same scrolled text widget.
> The application is created in vTcl using place.
>
> sample code of viish is as follows...
>
> proc Init {} {
> upvar #0 argv argv
> if {[winfo children .]==""} {
> if {![winfo exists .t]} {
> # demo mode
> wm title . TkVIish
> set ::sym::TopLevelFileCommands(.t) 1
> foreach i $argv {
> if {[file readable $i]} {
> ::sym::fs::defLoadFile .t "e
> $i"
> break
> }
> }
> text .t -yscrollcommand {.s set} -font $::fspc
> scrollbar .s -command {.t yview}
> text .e -state disabled -font $::fspc_sm -
> height 1
> pack .e -side bottom -expand true -fill x
> pack .s -side right -expand true -fill y
> pack .t -side left -expand true -fill both
> focus -force .t
> ::sym::symkeys .t .e
> ::sym::initfi .t
> }
> }
>
> }
>
> Init
>
> http://www.geocities.com/m_schrumpf/tcl/viish.tgz
>
> Melissa can you please help me out as you wrote the code of this viish.

I assume your GUI builder at least provides the creation of the text
widget and the associated scrollbar. For command input another input
field (.e text widget of height 1) is required and eventually has to
be created in your layout form too.
The above Init will do nothing, if the main window (named .) already
has children.
You need to find the name of your prebuilt text widgets and replace .t
(the widget containing the editable text) and .e (the 1 line input
field) with this names.
The lines with text, scrollbar and pack commands are not needed, as
the widgets supposedly exist. Please remove the restricting if clauses
too.
--
Roland Frank
From: amitmjoshi on
On Jun 23, 6:00 pm, rf <roland.fr...(a)free.fr> wrote:
> On 23 Jun., 12:26, "amitmjo...(a)gmail.com" <amitmjo...(a)gmail.com>
> wrote:
>
>
>
> > I have an application created using scrolled text widget.
> > How can i bind the viish bindings to the same scrolled text widget.
> > The application is created in vTcl using place.
>
> > sample code of viish is as follows...
>
> > proc Init {} {
> >         upvar #0 argv argv
> >         if {[winfo children .]==""} {
> >                 if {![winfo exists .t]} {
> >                         # demo mode
> >                         wm title . TkVIish
> >                         set ::sym::TopLevelFileCommands(.t) 1
> >                         foreach i $argv {
> >                                 if {[file readable $i]} {
> >                                         ::sym::fs::defLoadFile .t "e
> > $i"
> >                                         break
> >                                 }
> >                         }
> >                         text .t -yscrollcommand {.s set} -font $::fspc
> >                         scrollbar .s -command {..t yview}
> >                         text .e -state disabled -font $::fspc_sm -
> > height 1
> >                         pack .e -side bottom -expand true -fill x
> >                         pack .s -side right -expand true -fill y
> >                         pack .t -side left -expand true -fill both
> >                         focus -force .t
> >                         ::sym::symkeys .t .e
> >                         ::sym::initfi .t
> >                 }
> >         }
>
> > }
>
> > Init
>
> >http://www.geocities.com/m_schrumpf/tcl/viish.tgz
>
> > Melissa can you please help me out as you wrote the code of this viish.
>
> I assume your GUI builder at least provides the creation of the text
> widget and the associated scrollbar. For command input another input
> field (.e text widget of height 1) is required and eventually has to
> be created in your layout form too.
> The above Init will do nothing, if the main window (named .) already
> has children.
> You need to find the name of your prebuilt text widgets and replace .t
> (the widget containing the editable text) and .e (the 1 line input
> field) with this names.
> The lines with text, scrollbar and pack commands are not needed, as
> the widgets supposedly exist. Please remove the restricting if clauses
> too.
> --
> Roland Frank

I created the scrolled text widget as follows...
iwidgets::scrolledtext .st \
-visibleitems 80x50 \
-textbackground black \
-vscrollmode dynamic \
-hscrollmode dynamic \
-wrap none

pack .st \
-fill both \
-expand true

Now what should be my .t and .e components??
From: rf on
On 23 Jun., 16:38, "amitmjo...(a)gmail.com" <amitmjo...(a)gmail.com>
wrote:
> On Jun 23, 6:00 pm, rf <roland.fr...(a)free.fr> wrote:
>
>
>
> > On 23 Jun., 12:26, "amitmjo...(a)gmail.com" <amitmjo...(a)gmail.com>
> > wrote:
>
> > > I have an application created using scrolled text widget.
> > > How can i bind the viish bindings to the same scrolled text widget.
> > > The application is created in vTcl using place.
>
> > > sample code of viish is as follows...
>
> > > proc Init {} {
> > > upvar #0 argv argv
> > > if {[winfo children .]==""} {
> > > if {![winfo exists .t]} {
> > > # demo mode
> > > wm title . TkVIish
> > > set ::sym::TopLevelFileCommands(.t) 1
> > > foreach i $argv {
> > > if {[file readable $i]} {
> > > ::sym::fs::defLoadFile .t "e
> > > $i"
> > > break
> > > }
> > > }
> > > text .t -yscrollcommand {.s set} -font $::fspc
> > > scrollbar .s -command {.t yview}
> > > text .e -state disabled -font $::fspc_sm -
> > > height 1
> > > pack .e -side bottom -expand true -fill x
> > > pack .s -side right -expand true -fill y
> > > pack .t -side left -expand true -fill both
> > > focus -force .t
> > > ::sym::symkeys .t .e
> > > ::sym::initfi .t
> > > }
> > > }
>
> > > }
>
> > > Init
>
> > >http://www.geocities.com/m_schrumpf/tcl/viish.tgz
>
> > > Melissa can you please help me out as you wrote the code of this viish.
>
> > I assume your GUI builder at least provides the creation of the text
> > widget and the associated scrollbar. For command input another input
> > field (.e text widget of height 1) is required and eventually has to
> > be created in your layout form too.
> > The above Init will do nothing, if the main window (named .) already
> > has children.
> > You need to find the name of your prebuilt text widgets and replace .t
> > (the widget containing the editable text) and .e (the 1 line input
> > field) with this names.
> > The lines with text, scrollbar and pack commands are not needed, as
> > the widgets supposedly exist. Please remove the restricting if clauses
> > too.
> > --
> > Roland Frank
>
> I created the scrolled text widget as follows...
> iwidgets::scrolledtext .st \
> -visibleitems 80x50 \
> -textbackground black \
> -vscrollmode dynamic \
> -hscrollmode dynamic \
> -wrap none
>
> pack .st \
> -fill both \
> -expand true
>
> Now what should be my .t and .e components??

..st is the name of a widget and a command itself. Typing .st in an
interactive console window will show a list of defined commands.
I just tried ".st component text" and
got .st.lwchildsite.clipper.text, which should correspond to .t
Another -basic method- is to get the list of children with [winfo
children .st] and to examine every child with [winfo class $child], to
see the searched widget is a child of a frame widget.
The one line text widget .e is probably the entry for commands in
colon-mode and has, I suppose, to be created independently.
Perhaps it is far easier only to use a frame widget in the GUI and use
this frame as parent for the .t and .e widgets. I.e. given the frame
with .f, to use .f.t and .f.e.
From: amitmjoshi on
On Jun 23, 8:28 pm, rf <roland.fr...(a)free.fr> wrote:
> On 23 Jun., 16:38, "amitmjo...(a)gmail.com" <amitmjo...(a)gmail.com>
> wrote:
>
>
>
> > On Jun 23, 6:00 pm, rf <roland.fr...(a)free.fr> wrote:
>
> > > On 23 Jun., 12:26, "amitmjo...(a)gmail.com" <amitmjo...(a)gmail.com>
> > > wrote:
>
> > > > I have an application created using scrolled text widget.
> > > > How can i bind the viish bindings to the same scrolled text widget.
> > > > The application is created in vTcl using place.
>
> > > > sample code of viish is as follows...
>
> > > > proc Init {} {
> > > >         upvar #0 argv argv
> > > >         if {[winfo children .]==""} {
> > > >                 if {![winfo exists .t]} {
> > > >                         # demo mode
> > > >                         wm title . TkVIish
> > > >                         set ::sym::TopLevelFileCommands(.t) 1
> > > >                         foreach i $argv {
> > > >                                 if {[file readable $i]} {
> > > >                                         ::sym::fs::defLoadFile .t "e
> > > > $i"
> > > >                                         break
> > > >                                 }
> > > >                         }
> > > >                         text .t -yscrollcommand {.s set} -font $::fspc
> > > >                         scrollbar .s -command {.t yview}
> > > >                         text .e -state disabled -font $::fspc_sm -
> > > > height 1
> > > >                         pack .e -side bottom -expand true -fill x
> > > >                         pack .s -side right -expand true -fill y
> > > >                         pack .t -side left -expand true -fill both
> > > >                         focus -force .t
> > > >                         ::sym::symkeys .t .e
> > > >                         ::sym::initfi .t
> > > >                 }
> > > >         }
>
> > > > }
>
> > > > Init
>
> > > >http://www.geocities.com/m_schrumpf/tcl/viish.tgz
>
> > > > Melissa can you please help me out as you wrote the code of this viish.
>
> > > I assume your GUI builder at least provides the creation of the text
> > > widget and the associated scrollbar. For command input another input
> > > field (.e text widget of height 1) is required and eventually has to
> > > be created in your layout form too.
> > > The above Init will do nothing, if the main window (named .) already
> > > has children.
> > > You need to find the name of your prebuilt text widgets and replace .t
> > > (the widget containing the editable text) and .e (the 1 line input
> > > field) with this names.
> > > The lines with text, scrollbar and pack commands are not needed, as
> > > the widgets supposedly exist. Please remove the restricting if clauses
> > > too.
> > > --
> > > Roland Frank
>
> > I created the scrolled text widget as follows...
> > iwidgets::scrolledtext .st \
> >   -visibleitems 80x50 \
> >   -textbackground black \
> >   -vscrollmode dynamic \
> >   -hscrollmode dynamic \
> >   -wrap none
>
> > pack .st \
> >   -fill both \
> >   -expand true
>
> > Now what should be my .t and .e components??
>
> .st is the name of a widget and a command itself. Typing .st in an
> interactive console window will show a list of defined commands.
> I just tried ".st component text" and
> got .st.lwchildsite.clipper.text, which should correspond to .t
> Another -basic method- is to get the list of children with [winfo
> children .st] and to examine every child with [winfo class $child], to
> see the searched widget is a child of a frame widget.
> The one line text widget .e is probably the entry for commands in
> colon-mode and has, I suppose, to be created independently.
> Perhaps it is far easier only to use a frame widget in the GUI and use
> this frame as parent for the .t and .e widgets. I.e. given the frame
> with .f, to use .f.t and .f.e.

Hello Roland
Thanks for all your help.
I could do it successfully, thanks alot.

Amit M Joshi