FocusMaster with N1MM+ doesn't work for me

User avatar
W1JA
Posts: 25
Joined: Sun Apr 09, 2017 3:19 pm

FocusMaster with N1MM+ doesn't work for me

Postby W1JA » Sun Jun 11, 2017 12:44 pm

Here's what I've done to set it up.
1. In PowerSDR Setup > CAT Control > CAT tab, I've set the FocusMaster Mode to N1MM+ Logger. The N1MM+ Port and Delay fields are dimmed, so there's nothing for me to do there. I left the Window Title field blank, since I don't know what to put there -- the main N1MM+ window title varies (it contains the radio frequency so it changes dynamically).
2. In N1MM+ Config, I checked the 'Grab Focus from Other Apps when Radio is Tuned' setting.

But I don't get the result I expect:
I observe that if Google Chrome or Adobe Reader have focus, N1MM+ does indeed get focus right away when I tune the radio VFO with my CMD Micro MIDI controller. But if PowerSDR already has focus and I tune, the call entry field on N1MM+ flashes a bit, but it never gets focus.

Suggestions solicited.

73,
John W1JA
w9mdb
Posts: 91
Joined: Sun Apr 09, 2017 5:53 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w9mdb » Sun Jun 11, 2017 12:59 pm

You don't say what versions of N1MM+ or PowerSDR you are running.

In the notes on 3.4.1 it mentions an incompatibility problem with N1MM that was fixed.

So sounds like you may need to update PowerSDR and/or N1MM+

Seems that you should not need to set up N1MM+ for "grab focus" for PowerSDR.

de Mike W9MDB
w9mdb
Posts: 91
Joined: Sun Apr 09, 2017 5:53 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w9mdb » Sun Jun 11, 2017 1:12 pm

Come to think of it the behavior you describe sounds correct.
If PowerSDR is the active window you really wouldn't want something stealing focus while you're tuning.
Maybe what you want is a "Using MIDI controller" checkbox to force it or perhaps PowerSDR could recognize it's getting commands from MIDI so allow focus to change?
w9mdb
Posts: 91
Joined: Sun Apr 09, 2017 5:53 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w9mdb » Sun Jun 11, 2017 2:33 pm

I took a look at the FocusMaster code.
PowerSDR forces the N1MM+ window to foreground when N1MM+ sends a RadioInfo packet.

So, you don't need N1MM to grab focus (it really shouldn't matter).

But you do need N1MM+ to send RadioInfo packets. Under Config/Configure Ports.../Broadcast Data -- check the "Radio" entry.

de Mike W9MDB
User avatar
W1JA
Posts: 25
Joined: Sun Apr 09, 2017 3:19 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby W1JA » Sun Jun 11, 2017 3:10 pm

I'm using the very latest versions (3.4.1 and 1.0.6397.0).

Maybe you're right about not wanting something stealing focus from PowerSDR while I'm tuning. But it doesn't matter in my case because I can tune PowerSDR with my MIDI controller whether or not it has focus.

The problem is that PowerSDR gets focus when I click on one of its console buttons (such as mode or bandwidth). Then I tune with the MIDI controller, and PowerSDR keeps focus. Then I type a callsign and the keystrokes don't go to N1MM+ because it doesn't have focus. I thought that the N1MM+ option 'Grab Focus from Other Apps when Radio is Tuned' would do just what it says.

So what I want is for N1MM+ to grab focus from PowerSDR when I tune PowerSDR with my MIDI controller (which doesn't require PowerSDR to have focus). That way, N1MM+ would be ready to take keyboard entry when I need it (when I'm in S&P mode for example).

(My Radio checkbox on the Broadcast Data tab wasn't checked, but after checking the issue remains.)
User avatar
W2PA
Posts: 74
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: FocusMaster with N1MM+ doesn't work for me

Postby W2PA » Sun Jun 11, 2017 3:34 pm

I've experimented with this a bit just now too and conclude that this has nothing to do with FocusMaster.

With or without FocusMaster enabled, N1MM has its own ability to grab focus when the radio that it's connected to gets tuned. That is what you want to have happen so you can rapidly enter a call sign, as John pointed out, while in S&P mode.

Right now, what happens in 3.4.1 is that it appears that N1MM *tries* to grab focus. If you tune the radio, N1MM's icon flashes in the tray and its call sign entry field briefly changes color, but PSDR remains in focus and keyboard events go there, not to N1MM. Interestingly, N1MM *is* able to grab focus form other applications under Windows 10, such as browsers and what not.

So I'll have a look at the code some more and see what's what - but it'll take some time since it's a section I've never looked at. Maybe someone else here on the forum can add some additional understanding.

By the way, you can get the right behavior if you give N1MM focus first. Then, when you tune the radio with a MIDI controller, PSDR doesn't *take* focus, it remains with N1MM, and you're ready to enter a QSO. The same is not true if you tune PSDR with its UI.
73,
Chris, W2PA
User avatar
W2PA
Posts: 74
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: FocusMaster with N1MM+ doesn't work for me

Postby W2PA » Sun Jun 11, 2017 4:19 pm

Experimenting a bit further:
It's not really true that N1MM is able to grab focus *entirely* from other applications. If, for example, I have Firefox with focus, then tune PSDR using the MIDI controller, N1MM does indeed grab focus, but it doesn't activate its text entry field. Only when I touch the tuning knob a second time does it do that. So there may be an issue with this function in N1MM as well.
73,
Chris, W2PA
User avatar
W2PA
Posts: 74
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: FocusMaster with N1MM+ doesn't work for me

Postby W2PA » Sun Jun 11, 2017 5:22 pm

Well, there does seem to be some inconsistency going on.

N1MM now works fine with PSDR. Conditions are: PSDR set to N1MM+ Logger, N1MM+ set to Grab Focus. Now, N1MM+ will take focus after 2 seconds no matter which other window I click on. If I tune the radio, focus goes back to N1MM+. But occasionally, N1MM+ will grab focus but not activate its text entry box (and flash its icon).

So there is something intermittent happening that will take longer to sort out.
73,
Chris, W2PA
w9mdb
Posts: 91
Joined: Sun Apr 09, 2017 5:53 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w9mdb » Sun Jun 11, 2017 6:42 pm

This link 'splains when you can set focus and mentions the "AllowSetForeground" function. But that would be N1MM allowing it.
Perhaps PowerSDR could start the N1MM process and then it's more likely to work?
It sounds like the SPI_GETFOREGROUNDLOCKTIMEOUT might be of interest too. Default value is 0x2000 or 8.192 seconds
Also...maybe doing SetActiveWindow to N1MM may help? The mouse activity on PowerSDR might be affecting it's ability and setting the active window should fix that problem.

https://msdn.microsoft.com/en-us/librar ... 2147217396

It's always considered bad practice to set the focus to another app....for an app to grab focus is OK...but the other way 'round is frowned upon generally. If N1MM+ can grab why should PowerSDR force it?


de Mike W9MDB
User avatar
w-u-2-o
Posts: 1876
Joined: Fri Mar 10, 2017 1:47 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w-u-2-o » Sun Jun 11, 2017 6:47 pm

The Focusmaster feature first appeared in PowerSDR 3.2.26 in May, 2015. The original instructions for using it are as follows:

You will now find the FocusMaster feature on the Setup/CAT Control/CAT
tab. This feature is aimed primarily at contest operation and automatically
restores Windows "focus" back to your logging (or other) window after you
make an adjustment in PowerSDR. There are three modes to specify a window to
which you would like focus restored: (1) if you use the N1MM+ Logger, just
select this Mode and PowerSDR will automatically find the input window, (2)
Select by Click - choose this mode and then next Click within the window to
which you'd like focus restored, and (3) Enter Window Title - type in the
text of the window titlebar EXACTLY as it appears. You can also specify a
Delay time, the time between interaction with PowerSDR and return of focus
to the selected window.

For the N1MM+ Logger mode to function, PowerSDR must receive information
from the N1MM+ Logger program identifying the input window. To enable the
N1MM+ program to send this information, a few lines must be added to the
file N1MMLogger.ini . These can be added/modified with a text editor, e.g.,
Notepad, and should read:

[ExternalBroadcast]
DestinationIPs=127.0.0.1
DestinationPort=12060
IsBroadcastAppInfo=True
IsBroadcastContact=True
IsBroadcastRadio=True

Windows Firewall may ask you if it's OK to allow communication between
N1MM+ and PowerSDR to which, of course, you should respond that it is.

Note also that, to allow you sufficient time to configure the FocusMaster,
focus will NOT go to your selected program as long as the Setup/CAT
Control/CAT tab is open.

I have used it many moons ago with N1MM and it worked great at that time. I no longer have N1MM installed because I am not a contester.

73!

Scott
User avatar
W2PA
Posts: 74
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: FocusMaster with N1MM+ doesn't work for me

Postby W2PA » Sun Jun 11, 2017 6:55 pm

Thanks, Scott. Quite helpful. All of those settings in the .ini file are now selectable in N1MM's Configurator window.

The quirky behavior remains.
73,
Chris, W2PA
User avatar
w-u-2-o
Posts: 1876
Joined: Fri Mar 10, 2017 1:47 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w-u-2-o » Mon Jun 12, 2017 2:32 am

A few observations:

1. MIDI and CAT commands to PowerSDR will never cause focus to shift. So you can bang on your MIDI controller all day long and it should not cause focus to shift between programs on the PC.

2. The "Grab Focus" feature in N1MM did not exist when the Focusmaster feature was developed. It would seem that the Grab Focus feature, built into N1MM as it is today, makes Focusmaster redundant and unnecessary. I would suggest that one should use either Focusmaster or Grab Focus but not both. Indeed, just based on the description of Grab Focus in this thread, it appears that using Grab Focus would be preferable as it is more universal.

3. What field has an active cursor in it within N1MM when focus is returned to N1MM is most likely an issue with N1MM and not whatever mechanism causes focus to return to N1MM. If this is an issue I'd suggest contacting the author of N1MM.

73!

Scott
User avatar
W2PA
Posts: 74
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: FocusMaster with N1MM+ doesn't work for me

Postby W2PA » Mon Jun 12, 2017 8:36 pm

Scott,

I'd only make one slight modification to your #1:
MIDI and CAT commands to PowerSDR will never directly cause focus to shift. When the Grab Focus thing is active in N1MM+, using the MIDI controller to change frequency in PSDR is detected by N1MM+ which, in turn, causes focus to shift if Grab Focus is active.

I think you're right about letting N1MM+ do its thing all by itself, and that there may be some Windows quirks on that side of things. When I find a case that's repeatable I plan to send the N1MM team an email.
73,
Chris, W2PA
User avatar
w-u-2-o
Posts: 1876
Joined: Fri Mar 10, 2017 1:47 pm

Re: FocusMaster with N1MM+ doesn't work for me

Postby w-u-2-o » Mon Jun 12, 2017 8:59 pm

W2PA wrote:Scott,
MIDI and CAT commands to PowerSDR will never directly cause focus to shift. When the Grab Focus thing is active in N1MM+, using the MIDI controller to change frequency in PSDR is detected by N1MM+ which, in turn, causes focus to shift if Grab Focus is active.
That's very interesting, Chris. Perhaps it makes the case for doing the exact opposite, that is to turn off Grab Focus and turn on Focusmaster. Then, assuming you don't use any other programs other than PowerSDR and N1MM, using the MIDI control surface should not pull focus away from N1MM.

73!

Scott
User avatar
W2PA
Posts: 74
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: FocusMaster with N1MM+ doesn't work for me

Postby W2PA » Tue Jun 13, 2017 12:19 am

Well, I'm not so sure. Let me try to describe in as precise a way I can, how I think it should work. Anyone is, of course, free to disagree or correct - but I'll give it a shot. Either way, it's an interesting topic to consider here because we're bumping up against yet another change in operating practice brought about by the wonderful world of SDR.

To continue...

The contest logging SW (in this case N1MM+) ought to have focus priority since that is your primary control point when operating a contest - it's where you "live" while operating. You log, you initiate exchanges, you call CQ or you do S&P, all under control of the logging SW. So the discussion revolves around when are you touching the radio and when are you touching the software, and what happens when the radio *is* software.

PSDR doesn't need to have focus unless you are explicitly changing some parameter using the UI itself. If you carefully choose and map the most common radio controls to a MIDI controller - things like VFOs, AF/RF gain, RIT, filter adjustment, notch, etc. - then the UI very rarely needs to have focus.

Contesting using the PSDR UI alone can be problematic, since it has to have focus in order for you do adjust things. This is why you might want it to automatically relinquish control to the logger after a time delay, which is what FocusMaster tries to do for you. (Never mind, for the moment, that waiting the default 2 seconds for this to happen can often seem painfully slow.)

Things should work just fine, however, if focus can be grabbed back by N1MM+ whenever it's needed (usually to enter an exchange), and stay there unless something else needs control, which should be as rare an occurrence as possible. With a "knob-rig" this is the way it works. They've gone a step further in giving you the choice of having N1MM grab focus whenever the radio (HW or SW) is tuned. That function was invented for knob-rigs. (And it pertains to getting focus from other PC programs not necessarily radio-related.)

Now in the brave new world of SDR in which software *is* the radio, the closest you can come to this is to use a MIDI controller since doing that won't make your SDR console grab focus at all - just like tapping the key or pushing the PTT won't make it grab focus either. And if you're really going at it, you're never tapping or pushing those things anyway since the logging program is doing it for you.

I conclude, therefore, that if you're using only the PSDR UI to operate the rig, you should consider using FocusMaster to automagically pass focus back to the logging program so you don't have to click on it. And if you're using a MIDI controller to control all the radio controls you typically need during a contest, then you should consider using only the GrabFocus feature of N1MM+ and disable FocusMaster. The latter, is the way I plan to operate (and I am by no means a *serious* contester but I do like to dabble in them quite often).
73,
Chris, W2PA

Return to “Digital Mode, Rig Control & Logging Software”