Forum: Ruby Ruby Tk (make available of a single pointer(marker) of TkText)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
7caba80fca2ac4ddbb7f55957e5c0dec?d=identicon&s=25 Jun Young Kim (Guest)
on 2008-12-17 03:07
(Received via mailing list)

Now, I am trying to make simple Diff-viewer by using Ruby Tk.

But, I have a problems to show a pointer(cursor) on the TkText panel.

Simply, you can understand my case in the following code pattern.

        @leftText = do
             padx        0
             borderwidth 0
             background  'white'
             state       'normal'
         @rightText = do
             padx        0
             borderwidth 0
             background  'white'
             state       'normal'

Create both of TkText instances to show a diff of sources.

After inserting a source into TkText panel, I set

@leftText['state']   = :disabled
@rightText['state'] = :disabled

I know,  this two lines make uncursored panel.

But, without this lines, panel is modifiable. Users can delete and
insert their own texts.

Is any idea for this ?
F6a834b9e424a1e5b199db450462b6cd?d=identicon&s=25 Ron Fox (Guest)
on 2008-12-17 12:15
(Received via mailing list)
Jun Young Kim wrote:
>              borderwidth 0
> Create both of TkText instances to show a diff of sources.
> Is any idea for this ?
I don't know enough about Ruby to be sure, but one method we Tcl/Tk
programmers would use is the Tk Bind command to catch keystroke events
and then decide what to do based on the keystroke.  That can be used
to bypass the default key event bindings to insert text.

But a question I'd ask is why do you want a cursor on an unmodifiable
text widget.  That seem counter to GUI design patterns which say that
a cursor is an insertion point in text items.  Do you really just want
a scroll bar and tandem scrolling between both text widgets in some way?
This topic is locked and can not be replied to.