• Focus text widget

    From Andy Maleh@21:1/5 to All on Sat Nov 6 12:15:05 2021
    How do I bring focus to text widget? I tried takeFocus, but it didn't seem to be doing anything.

    I have this Tk Word Processor code sample written in Ruby (Hello, Text!): https://github.com/AndyObtiva/glimmer-dsl-tk#hello-text

    Code:

    https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_text.rb

    Screenshot:

    https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-text.png

    The main issue I have is after applying formatting to the text by mouse-clicking a button from the top toolbar (e.g. Bold or Italic), the focus does not go back to the text widget afterwards to enable the user to continue typing from where they had the
    insert mark.

    I would like to bring the focus back to the text widget after interacting with the toolbar. I noticed that with the entry widget, I could set the state to focus and that brings focus to it. I could not do the same with the text widget.

    Help would be appreciated.

    Andy Maleh

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Andy Maleh on Sat Nov 6 19:39:32 2021
    Andy Maleh <andy.am@gmail.com> wrote:
    How do I bring focus to text widget?

    Have you tried the 'focus' command?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Maleh@21:1/5 to Rich on Sat Nov 6 14:31:14 2021
    On Saturday, November 6, 2021 at 3:39:35 PM UTC-4, Rich wrote:
    Andy Maleh wrote:
    How do I bring focus to text widget?
    Have you tried the 'focus' command?

    I just tried it and it worked!

    Thank you very much.

    I was making a very silly mistake (calling text.focus = true instead of just text.focus)

    Cheers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)