Submitted by carloscadu on 2020/01/10 11:26
DocPane losing focus when interacting with external apps
 
Hi,
 
As shown in the screencast (http://bit.ly/39Zhupy), DocPane is losing focus when interacting with external apps.
 
In the screencast I exemplified using an AutoHotkey menu with scripts to (a) send text into IQ DocPane, (b) getting text from IQ DocPane and send to MSWord. In both cases, I couldn’t accomplish the tasks because IQ is losing focus from DocPane to the actual grid’s item.
 
So (a) send text into IQ DocPane overlaps the actual grid’s item instead, and (b) getting text from IQ DocPane and send to MSWord is sending the actual grid’s item text instead.
 
For exemplifying similar scenarios in which the (a) and (b) do work, I used in the screencast Freeplane and Mindmanager “Note Panes” interaction.
 
Would it be possible to stick the focus on IQ DocPane, like Freeplane and Mindmanager do?
 
Thank you!
Carlos
 

Comments

Hello Carlos,
 
As they say a picture/video is worth a thousand words. Did you notice that as you call up the auto hot key context menu the color of the task pane changes, showing us in real time when the doc pane is losing focus? That makes sense because the moment I click in any other program the doc pane loses focus. And the moment IQ is selected the pane becomes active again.
 
I noticed that IQ also has a custom command available named "grid----document pane" that toggles focus back and forth between an item and the document pane, in case that could be triggered by a script.
 
Until Pierre offers a solution, couldn't you create a comparable script that could bring focus back to the doc pane as the very first action of the script? So, bring up context menu and doc pane loses focus, now select your script and the first command is to launch/give focus to the active instance of IQ.
 
David
 

I agree it's probably a problem with the script rather than with InfoQube. If you press Ctrl-C, the text is copied from the document pane rather than the grid, so the script must be doing something that changes the focus in IQ. If you just open the AHK menu with the hotkey and close the AHK menu without doing anything (by pressing Escape?), does that already take the focus away from the doc pane or does it only happen after you select specific commands from you AHK menu? If it only happens, e.g. with the 'send to Word'  command, can you share the AHK code for that command?

 Actually I don't think it's a script issue. That context menu is treated like another program and when it's brought up the IQ document pane loses focus and transfers to the item. So I think it's an IQ issue. But I still wonder if he could insert something into his script to take focus back to IQ, at which point the document pane will take over focus again.

Not sure about that. I can alt-tab in and out of IQ and copy / paste text to / from the Doc pane without any focus issues, can't you guys? But maybe the script is sending command keys too soon and a couple of 'sleep' statements would do the trick... Still, my guess is the script doesn't store the active control but activates the main window class / handle instead, thus putting focus in the grid control.

David_H

2020/01/12 13:04

In reply to by LeftEccoForIQ

[quote=LeftEccoForIQ]Not sure about that. I can alt-tab in and out of IQ and copy / paste text to / from the Doc pane without any focus issues, can't you guys?[/quote]
Yes, but that's completely different than what he's trying to do. The issue is that when he calls up his context menu that is the equivalent of alt-tabbing into another program. And he wants to be able to send the script/paste command from that program. Which works fine with other "single pane" programs such as word.
 
But with IQ the moment its window is not active, it defaults away from the document pane back to the item. So now he tries to activate the script and it's sending the text to the item. What IQ would need to do is keep whatever was last selected active (whether that is the item, doc pane, property pane etc.) even when it is not the active window. Then his script would work.
 
Since that is not how it currently works, that is why I suggested maybe he could start his script with a command to make the IQ window active, which would be the equivalent of alt-tabbing back into the program.
 
It'll be interesting to see if Pierre has a different solution.
 
 

It is indeed a question of timing. On my system, this assigned to a hotkey (pressed with another app's window active in the foreground) copies the item text:
 
    WinActivate, IQ -
    Send ^c
 
but this
 
    WinActivate, IQ -
    Sleep 200
    Send ^c
 
copies the text selected in the doc pane. So the script should be easy to fix, just insert the 'sleep' command and play with the value.

David_H

2020/01/12 21:25

In reply to by LeftEccoForIQ

 There you go! Thank you for posting that. I only started playing with AHK after reading his post. Do you find it useful? I'm not sure what I would use it for....but that's probably because I haven't :-D.

If you're not doing any kind of scripting with other tools, you should certainly find it useful and worth the time you need to invest. It is an automation tool that can help you with repetitive tasks (calculations, copy/paste etc.), manage windows, launch stuff, remap keys, create custom GUIs (like the menu in the OP's example) etc.

carloscadu

2020/01/28 10:00

In reply to by LeftEccoForIQ

Thank you all for the feedback and insights!
The script could be fixed by adjusting only the sleep timing on the second line:
 
------------------------------------------------------------------------------------------------
!#s::                   ;shortcut (! alt / # win / ^ ctrl / + shift)                                                   
sleep 150               ;minimum time needed to run the script from an AHK menu, allowing the focus to return to IQ after clicking on the menu (no need to `WinActivate, IQ` since after clicking on the menu the focus goes to the 'below' application automatically)
Send ^c
SendMode, Input
RunWait, winword
WinActivate, Microsoft Word
sleep 700       ;time needed to create a new .docx file and paste IQ content into it (necessary to uncheck 'Word options>Start up options> Show the Start screen when this application starts')
Send ^v
------------------------------------------------------------------------------------------------
 
I highly recommend AHK for automating and improving computing workflows. Here some resources:
 
Cheers,
Carlos