Nп/п : 22 из 100
 От   : The Rickster                        2:5075/128        01 сен 23 19:37:17
 К    : The Rickster                                          01 сен 23 05:41:01
 Тема : Re: Unable to windows cursor to focus on entry box
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<7da30f90-6747-434e-9532-f781dd487d3fn@googlegroups.com> 4ea935ae
@REPLY:
<31d0f63f-bb4a-4c70-b24f-d3e205eedb57n@googlegroups.com> f5db38dd
@REPLYADDR The Rickster <sled99dog@gmail.com>
@REPLYTO 2:5075/128 The Rickster
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<3a81c244-891a-4de2-b6b2-b1e2a21a6b82n@googlegroups.com> <8729bd76-4c6a-4547-9cd0-28b3eadb6116n@googlegroups.com>
<31d0f63f-bb4a-4c70-b24f-d3e205eedb57n@googlegroups.com>
@RFC-Message-ID:
<7da30f90-6747-434e-9532-f781dd487d3fn@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
On Thursday, August 31, 2023 at 1:28:41 PM UTC-7, The Rickster wrote:
> On Wednesday, August 30, 2023 at 11:36:41 AM UTC-7, greg wrote: 
> > The Rickster schrieb am Mittwoch, 30. August 2023 um 07:12:06 UTC+2: 
 > > > There is a windows speech application that is invoked with
the Win key + h. Thanks to greg and others, it can be done
programmatically. However the focus must be on an entry box so that the spoken text
may be placed there. However, what happens is that when the .tcl script
is selected in explorer, the cursor remains over the .tcl file and the
code gets invoked twice. So, it seems that focus is not moved away and
the mouse down invokes it a second time. I thought focusmodel and focus
would make what was needed happen. 
> > > The twapi mouse down has to occur in the entry box. 
 > > > (by the way, if I\\we can get this working then there is
a way to use azure speech for $0) 
> > > 
> > > The tcl code is - 
> > > package require twapi 
> > > 
> > > set SRStatement {} 
> > > wm iconify . 
> > > console hide 
> > > 
> > > set top [toplevel .t1 -background {light blue}] 
> > > set theLabel [label $top.l1 -text {hello joe}] 
 > > > set theEntryBox [ttk::entry $top.e1 -textvariable SRStatement
-width 20 -font {{Segoe UI bold} 10}] 
 > > > set theExit [ttk::button $top.b1 -text Close -command {destroy
. $top ; exit}] 
> > > 
> > > pack $theLabel $theEntryBox $theExit -side top -pady 16 
> > > 
> > > wm focusmodel $top active 
> > > tkwait visibility $top 
> > > focus $theEntryBox 
> > > update 
 > > > # make the mouse selection to indicate the text entry
location for speech rec output 
> > > ::twapi::click mouse button right 
> > > 
> > > ::twapi::send input {"keydown 0x5B 0" "key 0x48 0" "keyup 0x5B 0"} 
> > #https://twapi.magicsplat.com/v4.7/ui.html#tkpath to hwnd 
> > #https://twapi.magicsplat.com/v4.7/ui.html#set focus 
> > 
> > ... 
> > twapi::set focus [twapi::tkpath to hwnd $theEntryBox] 
> > ...
 > Thanks ... was moving in that direction (pardon the pun). But
seeing how you wrote it gives confidence. Think biggest cerebral issue was
pointed out by Rich, Needed to separate Windows from TK. 
 > Thanks again...and for what it is worth, this is a way to
use\try out Azure speech rec (NOT VOICE REC, as many call it! {;-) )
 Turns out, only solution is to use winfo to locate position of
entry box, adjusted for screen location of toplevel, then use twapi to
move the windows cursor accordingly. Next twapi click mouse button was
used to effect physical, windows focus and, finally, invoke MS VoiceType
with twapi send input.

 Appreciate all of the help getting this solution. Going to open
another discussion on behavior of entry.
--- G2/1.0
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх