• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Select docked view via code

Messages
26
Country
newzealand
Is anyone aware of a means to select a particular docked view using code?
There don't appear to be any Simconnect commands for doing it, and I'm not having any luck trying to set focus to a child handle via the Windows API.
The closest I can get to what I want is by automating a mouse click in the area of the view, but in VC, you risk activating a knob or switch if your program does a random mouse click. I don't want to step through menu items either, as that is slow and disruptive.

Anyone with a cunning way to do it, I'd be most interested to hear.
 
In the PANEL_SERVICE_CONNECT_TO_WINDOW case of the gauge callback function, the extra_data parameter is a pointer to an integer containing the panel window's ident number. Does issuing a panel_window_open_ident command bring it to the front if it is undocked?
 
Thanks for the suggestion. Gauges aren't something I've worked with before, so it's going to take a bit of reading and tinkering to get my head around your idea....
 
I'll post some code when I get home from work.

Edit: sample code uploaded.
 

Attachments

Last edited:
Were you looking for a strictly gauge based solution, or do you want to do this with an external app?
 
I'm working with an external VB.NET app.
The primary screen is split into 2 docked views for stereo 3D, and they have to pan in unison.
One view is master, the other slave. When slave view has focus, I want to transfer focus back to the master as that's the one I want panned. Slave view subsequently matches masters direction.
 
Ah, OK. If I had actually read what you wrote...
You're right, FS doesn't like us messing with its windows through the Windows APIs. The only other thing I can think of is checking which window is higher in the Z-order. If it happens to be the slave, then match the master's movements to the slave, rather than the other way around.
 
The Z-order of the extra docked views View 01, View 02 etc changes depending on which is active, something I hadn't noticed until now. View 00 comes bottom of the list however, irrespective of whether it is the active view or not.
SetWindowPos does change size, position etc, but doesn't change which one is active.
If there's only 00 and 01 open, and I'm reasonably sure that 00 is active, Ctrl+Tab sendkeys can do the job, but otherwise its back to clicking. I got a vague idea about looking at a few pixels to see if an arrow or a hand (i.e. over a control) is at the cursor, but probably won't get around to that as I'm moving more towards masking the panning and replacing it with my own code that simultaneously does both views. That's actually in place - I was just keeping the master/slave method as an alternative option.
 
Back
Top