KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: inputBox appearing behind windows
Topic Summary:
Created On: 12/24/2020 01:16 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 inputBox appearing behind windows   - Todachen - 12/24/2020 01:16 PM  
 inputBox appearing behind windows   - Alan Cantor - 12/24/2020 01:46 PM  
 inputBox appearing behind windows   - Alan Cantor - 12/24/2020 02:33 PM  
 inputBox appearing behind windows   - Todachen - 12/24/2020 03:19 PM  
 inputBox appearing behind windows   - Matt_Chambers - 12/24/2020 03:58 PM  
 inputBox appearing behind windows   - Lunis Orcutt - 12/24/2020 04:27 PM  
 inputBox appearing behind windows   - Todachen - 12/24/2020 05:08 PM  
 inputBox appearing behind windows   - Todachen - 12/24/2020 05:03 PM  
 inputBox appearing behind windows   - Matt_Chambers - 12/24/2020 05:53 PM  
 inputBox appearing behind windows   - Matt_Chambers - 12/31/2020 12:46 PM  
Keyword
 12/24/2020 01:16 PM
User is offline View Users Profile Print this message

Author Icon
Todachen
Junior Member

Posts: 37
Joined: 09/30/2020

Hi everybody,

So I'm trying to make a command with  inputBox for the 1st time. Whenever the macro fires, the InputBox appears behind all other windows on the screen. Does anybody have any ideas of how I fix this? Your assistance would be greatly appreciated :-).

Script:

Sub Main
    
    i = InputBox$("Did I appear on top?", "What the Heck!","")

    If i = "yup" Then
        MsgBox "Congratulations! Now move on with your day."

        Else

        MsgBox "No joy!"

    End If

End Sub




-------------------------

My voice computer: W10/DPI 15.6/KB2017/VC 2020 on a Intel Core i7-8559U CPU @ 2.70GHz, 16gb DDR4, Sennheiser ME 3D 431 II / Roccat Juke – ROC-14-11-AM

 12/24/2020 01:46 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 3989
Joined: 12/08/2007

It's been a long time since I used an input box with Dragon. The last time was before I switched to Windows 10.

I tested your script and so far, I have replicated your result every time: the input box does not receive focus.

The input box is not focused even when there are no open windows and when the Dragonbar is in system tray mode.

Perhaps it's a Windows 10 thing?
 12/24/2020 02:33 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 3989
Joined: 12/08/2007

Here is a workaround, albeit not a practical one!

To bring the input box to the fore, say "press Shift Alt Tab" or "switch to previous window."



 12/24/2020 03:19 PM
User is offline View Users Profile Print this message

Author Icon
Todachen
Junior Member

Posts: 37
Joined: 09/30/2020

Thanks Allen,

My only goal is really to just capture a string from the user. I take it then that the InputBox$is outdated.

So perhaps a better question might be: what's the best way to present a window in which the user has unlimited time to provide a text string to use as a variable?

Should I just make a Dialog box?



-------------------------

My voice computer: W10/DPI 15.6/KB2017/VC 2020 on a Intel Core i7-8559U CPU @ 2.70GHz, 16gb DDR4, Sennheiser ME 3D 431 II / Roccat Juke – ROC-14-11-AM



 12/24/2020 03:58 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 341
Joined: 08/09/2018

I just tested an old command of mine that uses a Dialog Box for input and it has the same problem, with the box not coming to the foreground. (I also see this on occasion with Message Boxes, too.)

I don't have an immediate fix for this, unfortunately.
 12/24/2020 04:27 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 38502
Joined: 10/01/2006

Rather than reinventing the proverbial wheel, why not use Notepad. It's extremely fast and doesn't prompt you to save your file if you cut or delete the contents. If you're using KnowBrainer 2017 try saying Notepad<We are out of Mad Dod hillbilly eggnog  which will open Notepad and simultaneously type "We are out of Mad Dog hillbilly eggnog". Say Transfer your Notepad text to Windows clipboard, close Notepad and paste the Clipboards contents into the previous target. In other words a fast version of Dragon's Dictation Box which also doesn't fall behind other Windows



-------------------------

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1



 12/24/2020 05:08 PM
User is offline View Users Profile Print this message

Author Icon
Todachen
Junior Member

Posts: 37
Joined: 09/30/2020

Thanks Lunis. That's a great solution.



-------------------------

My voice computer: W10/DPI 15.6/KB2017/VC 2020 on a Intel Core i7-8559U CPU @ 2.70GHz, 16gb DDR4, Sennheiser ME 3D 431 II / Roccat Juke – ROC-14-11-AM

 12/24/2020 05:03 PM
User is offline View Users Profile Print this message

Author Icon
Todachen
Junior Member

Posts: 37
Joined: 09/30/2020

Thanks Matt. I suppose we might be able to assume that these objects do not play well with the latest version of .NET Framework.



-------------------------

My voice computer: W10/DPI 15.6/KB2017/VC 2020 on a Intel Core i7-8559U CPU @ 2.70GHz, 16gb DDR4, Sennheiser ME 3D 431 II / Roccat Juke – ROC-14-11-AM

 12/24/2020 05:53 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 341
Joined: 08/09/2018

You might try the two registry changes discussed here: https://www.knowbrainer.com/forums/forum/messageview.cfm?catid=4&threadid=24109

I just tried them and the dialog box now works, after a reboot.  Let me know if you want to see the script.



 12/31/2020 12:46 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 341
Joined: 08/09/2018

Looks like I screwed up and posted the wrong link for the solution. There are a couple of solutions floating out there on the Internet, all of which seem to involve a registry setting called  ForegroundLockTimeout. Some also recommend editing a registry setting called ForegroundFlashCount. Here are some links:

https://www.ghacks.net/2015/09/07/fix-file-dialog-prompts-not-spawning-in-the-foreground-in-windows-10/

www.tenforums.com/general-support/41975-very-annoying-issue-when-multiple-apps-open.html

Here's the wording of a sample command that takes whatever you have dictated into the input box and surrounds it with parentheses and quotation marks. Obviously, you could do more sophisticated operations.

I don't use this command much anymore, because of the open-ended command feature using the <dictation> argument, which makes this kind of command unnecessary in most cases.

Here it is:

Option Explicit

Dim result As Integer

Sub Main

Begin Dialog UserDialog 400,98,"Defined Term Box",.setfocus '%GRID:10,7,1,1

Text 20,14,180,14,"Enter the Term Here",.Text1

TextBox 20,35,370,21,.TextBox1,1

OKButton 70,63,90,21

CancelButton 220,63,90,21

End Dialog

Wait .5

Dim dlg As UserDialog

result=Dialog (dlg)

If result=-1 Then

Clipboard dlg.TextBox1

SendKeys " {(}+'^v+'{)}"

End If

End Sub

Private Function setfocus(DlgItem$, Action%, SuppValue& As Boolean

Select Case Action%

'Case 1 ' Dialog box initialization

'Case 2 ' Value changing or button pressed

Rem setfocus=True ' Prevent button press from closing the dialog box

'Case 3 ' TextBox or ComboBox text changed

'Case 4 ' Focus changed

Case 5 ' Idle

DlgFocus "textBox1"

Rem Wait .1 : setfocus=True ' Continue getting idle actions

'Case 6 ' Function key

End Select

End Function

Statistics
31938 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 3 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 552 guests browsing this forum, which makes a total of 555 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.