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

**URL:** <https://www.ruby-forum.com/t/ruby-tk-make-available-of-a-single-pointer-marker-of-tktext/155808>\
**Category:** Ruby\
**Created:** [December 17, 2008, 3:07am UTC](https://www.ruby-forum.com/t/ruby-tk-make-available-of-a-single-pointer-marker-of-tktext/155808 "2008-12-17T03:07:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jun\_YSKim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a587f6/32.png) [@Jun\_YSKim](https://www.ruby-forum.com/u/Jun_YSKim)\
**Post date:** [December 17, 2008, 3:07am UTC](https://www.ruby-forum.com/t/ruby-tk-make-available-of-a-single-pointer-marker-of-tktext/155808/1 "2008-12-17T03:07:37Z")

</div>

Hi,

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 = TkText.new(leftFrame) do
         padx 0
         borderwidth 0
         background 'white'
         state 'normal'
     end
     @rightText = TkText.new(rightFrame) do
         padx 0
         borderwidth 0
         background 'white'
         state 'normal'
     end

```

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 ?

---

<div class="post-metadata">

**Author:** ![Jun\_YSKim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a587f6/32.png) [@Jun\_YSKim](https://www.ruby-forum.com/u/Jun_YSKim)\
**Post date:** [December 17, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/ruby-tk-make-available-of-a-single-pointer-marker-of-tktext/155808/2 "2008-12-17T12:15:52Z")

</div>

Jun Y. 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?
