Jump to content
The simFlight Network Forums

A question of focus...


Recommended Posts

Hi all

I'm trying to do something simple, yet it turns out to be quite a bit more complicated than I thought...

I'm using P3Dv5 and most I fly FSlabs A320. I have a button on my joustick assigned to Captains view and another to FO view. And I can pan aound just fine using the hat switch.

But I would like to be able to use the Mouse to look around also - easy peasy, right? WRONG!

The problem is not to get Mouse Look working, I can do that by assigning Spacebar to a mousebutton, or I can trap the middle mouse button. But however I do it, I run into trouble because I usually undock the 2 MCDU's and this confuses Mouselook. I usually wind up looking straight back into the headrest - UNLESS I remember to click in the main window BEFORE a try to use Mouse Look.

It seems to me that is is probably due the MCDU window getting the focus, and since that is a flat 2D instument, Mouselook gets confused.

I have tried lots of things, but the only thing that seems to work is to have my LUA script move the cursor and issue a click. But that is too risky, since I cannot know if a crucial switch is at the center of the screen, when I do this. None of the ways I have tried to set the focus to the main FS window seems to work (ext.focus etc). And as for ext.gethandle using the window title: it MIGHT work, but it is a long title, and it changes according to number of attached wideclients. 

It might also be possible to use FSUIPC Mousewheel MOVE, but using my Thrustmaster A320 Throttle and sidestick with FSlabs A320 apparently demands that the joysticks be enabled in P3D.  

Any ideas? I'm attaching the script I'm using to trap the middle mouse wheel.

BRGDS 

Sven Sorensen, EKCH

MousTrap.lua

Link to comment
Share on other sites

Are you using the Advanced Mouse Controls option in P3D?

35 minutes ago, svenks said:

None of the ways I have tried to set the focus to the main FS window seems to work (ext.focus etc).

So ext.focus(0) and ext.focus() do not set the focus back to the FS main window? If not, where does the focus go - does it change at all?
You could also try using the key focus restore control (1125), i.e. ipc.control(1125).

40 minutes ago, svenks said:

It might also be possible to use FSUIPC Mousewheel MOVE, but using my Thrustmaster A320 Throttle and sidestick with FSlabs A320 apparently demands that the joysticks be enabled in P3D.  

But you can still do/try this when controllers are enabled in P3D,,,I can't see what having controllers enabled in P3D has anything to do with this....

 

Link to comment
Share on other sites

Hi John

Thanks for a quick reply.

Advanced controls are set OFF, as it will cause another sort of movement than mouse look using the middle/wheel button - sideways panning etc. Manually pressing spacebar still give you mouse look, but does not solve the problem.

ext.setfocus doesn't APPEAR to do anything in this case, but on the other hand FS still sems to have focus - it just resides with the MCDU window.

FSUIPC documentation for Mouse.Move states "...be sure not to have it enabled if you do have controllers enabled in P3D as the two facilities will clash". And it does behave weird...

ipc.control(1125) doesn't change anything....

Now, if only I could remember to click the main window each time I want to use mouse.look - but...

BRGDS

Sven

 

Link to comment
Share on other sites

33 minutes ago, svenks said:

FSUIPC documentation for Mouse.Move states "...be sure not to have it enabled if you do have controllers enabled in P3D as the two facilities will clash". And it does behave weird...

I think you mean Mouse Look, not move. 

36 minutes ago, svenks said:

ext.setfocus doesn't APPEAR to do anything in this case, but on the other hand FS still sems to have focus - it just resides with the MCDU window.

I thought this would set focus to the main FS window - it surprises me that the focus stays with a sub-window. I will check this at some point.

38 minutes ago, svenks said:

ipc.control(1125) doesn't change anything....

Yes, sorry - looking further at this it seems that this restores the focus to the previous window that held the focus, after it has been moved to another window.

2 hours ago, svenks said:

the only thing that seems to work is to have my LUA script move the cursor and issue a click. But that is too risky, since I cannot know if a crucial switch is at the center of the screen, when I do this.

Why don't you move it to a corner rather than the centre, i.e. use mouse.move(0, 0, 2). There should not be any switch in that position.

I will do some tests on the focus movement in P3Dv5 later this week, when I have time, and will report back.

John

 

Link to comment
Share on other sites

Hi John

Mouse Look, of course! But I accidentally enabled Mouse Move, and this caused the weird movements I saw. But it is true that enabling Mouse Look in FSUIPC and having controls enabled in P3D will cause erratic behaviour.

2 hours ago, John Dowson said:

Why don't you move it to a corner rather than the centre, i.e. use mouse.move(0, 0, 2). There should not be any switch in that position.

You cannot know. If I have used Mouse Look, I could easily have a switch right under any coordinates, unless of course 0,0 is in the title bar.

Tried it - it's the menu bar, and so Scenario is selected 🙂

Isn't there really no other way than a click to move the focus? I'm beginning to think this is not doable with the tools at hand.

Again, thanks for your efforts,

BRGDS

Sven

Link to comment
Share on other sites

26 minutes ago, svenks said:

Tried it - it's the menu bar, and so Scenario is selected 🙂

👍

26 minutes ago, svenks said:

Isn't there really no other way than a click to move the focus? I'm beginning to think this is not doable with the tools at hand.

As I said, I am surprised that the setfocus call doesn't move the focus to the main FS window. I will check this later in the week.
May also be worth trying two consecutive setfocus calls...

Cheers,

John

Edited by John Dowson
Further info added
Link to comment
Share on other sites

Ok, I have taken a look an can see the issue. The ext.setfocus() lua call does change the focus to the main FS window, but the mouse-look controls are still applied to the sub-window and not the main window with the focus, and the only way to switch the mouse-look focus is to click in the window. This is very strange and I don't understand why. I will ask about this on the P3D forums.

18 hours ago, svenks said:

While we're at it, shouldn't ipc.control(1127) and (1128) do the same as Spacebar down, then up?

Because they don't do anything...

They should and I have checked this here (via button assignments though, not lua) and they seem to work as expected. Why do you think they are not working?

Link to comment
Share on other sites

4 hours ago, John Dowson said:

They should and I have checked this here (via button assignments though, not lua) and they seem to work as expected. Why do you think they are not working?

Hi John

Yes, they should - but they don't do anything when used from LUA. I even created a small section in LINDA user modules for A320 and assigned FIRE1.Press to do ipc.control(1127) and FIRE1.Rlse to do ipc.control(1128). Nothing happens.

I'm attaching a partial FSUIPC.LOG. In the first part, I am using ipc.control(1127) and (1128) from my MousTrap.lua script. Then I changed the script and loaded The Mooney Bravo, so now it's using ipc.control(1071, 32) and (1072, 32). As you can see, this DOES invoke Mouse Look.

BRGDS

Sven

fsuipc.log

Link to comment
Share on other sites

Hmmm, regarding 1127 and 1128.

Even if I assign Mouse Look On and Mouse Look Off directly in FSUIPC, they don't do anything - UNLESS I also enable Mouse look in FSUIPC's Misc section.

And If I do that, well, as I said it does behave weird and sluggish probably due to the conflict I have mentioned earlier.

So that was the explanation for 1127 and 1128...

On the focus related and original problem, I found out a small detail, which might provide an extra clue: All child window, docked or undocked, causes this behaviour, once they have had focus (provided you don't click in the main window afterwards). But the smaller the child widow is, the less movement you have in the main window. So the main window does move, but it can only move within the size of the child window. Therefore, it is really annoying to see this on an MCDU (where it's impossible to move away from a close-up of the headrest), but if it's the overhead panel causing it, you have almost free movement.

BRGDS

Sven

Link to comment
Share on other sites

1 minute ago, svenks said:

But the smaller the child widow is, the less movement you have in the main window. So the main window does move, but it can only move within the size of the child window. Therefore, it is really annoying to see this on an MCDU (where it's impossible to move away from a close-up of the headrest), but if it's the overhead panel causing it, you have almost free movement.

Cancel that, I just tried with an undocked Overhead Panel (which I moved to another screen) and got the stupid headrest I cannot move away from until I click it first.

Sorry about that,

Sven

Link to comment
Share on other sites

6 minutes ago, svenks said:

Even if I assign Mouse Look On and Mouse Look Off directly in FSUIPC, they don't do anything - UNLESS I also enable Mouse look in FSUIPC's Misc section.

Yes - you have to have Mouse Look enabled for those controls to work, as they toggle mouse look on/off only when it is enabled.

As I said, for the focus issue I will ask P3D - but first I need to check in P3Dv4 and P3Dv6 to see if they have the same issue.

Cheers,

John

 

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.