plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

In the upcoming flighting, we've changed the behaviour of the content.xml file. If your addon uses this file, please read this article!

Please take a moment to read the platform’s guidelines before you get started!


question

DA40CGDFQ avatar image
DA40CGDFQ asked DA40CGDFQ commented

InGamePanel - turn off widget/menu icon if aircraft not selected

I have an InGame panel for my aircraft, however it always shows on the widget menu even if my aircraft is not the user aircraft. I know I can turn the widget off using the settings gear icon, But I want my InGame panel (widget menu icon) to show only if my aircraft is selected.

aircraft
3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Simbol avatar image Simbol commented ·
I believe this happens because your project was loaded l, at that point it stays on always until Msfs resets.


Can you check if when you load Msfs from fresh and you load another aircraft, the panel is not loaded?


This is the behavior I see on my side.


Raul

0 Likes 0 ·
DA40CGDFQ avatar image DA40CGDFQ Simbol commented ·
I was not clear enough, sorry, the I mean the widget in the top menu is always shown, I have two aircraft with the ingamepanel and the widget icon shows both no matter what aircraft I select. So the spb file in the main ingamepanel folder has to have some way of loading based on a variable. Is there such a variable?
0 Likes 0 ·
CaptMatto avatar image CaptMatto commented ·
I also have this issue with my G36 Improvement Project, loaded or unloaded. It would be great for the panel to load per aircraft.
0 Likes 0 ·

1 Answer

·
virtuali avatar image
virtuali answered DA40CGDFQ commented

If your airplane has code in Javascript, you can enable a toolbar panel this way:

Coherent.call("TOOLBAR_BUTTON_TOGGLE","YOUR_PANEL_ID",true);

Your panel id is the one matching the panel-id tag in your html file, and passing false as the 3rd parameter will disable it.

If, instead, your airplane is WASM/C++, you are out of luck, so I suggest to vote my proposal to expose Coherent calls to WASM:

https://devsupport.flightsimulator.com/idea/6516/exposing-coherent-to-wasm.html

Being able to dynamically turn off panels when not required was the main reason of my suggestion.

3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

DA40CGDFQ avatar image DA40CGDFQ commented ·
Thank you for this, but I believe this code will stop/show the panel, I want to stop the icon from appearing in the toolbar at the top of the sim window. Right now the spb code puts the widget icon in the toolbar, is there xml code to stop the spb file from loading.
0 Likes 0 ·
virtuali avatar image virtuali DA40CGDFQ commented ·

Try with TOOLBAR_BUTTON_ENABLE instead of toggle, passing false should disable the panel icon, which I guess you should do before returning to the main menu, and enable it when the airplane loads.

-1 Like -1 ·
DA40CGDFQ avatar image DA40CGDFQ virtuali commented ·
Thanks again, This kinda works, however it does not stop the sbp file from loading, as the panel javascript is not loaded until the aircraft is selected and the Fly button is pressed. Once the icon is shown in the toolbar then the user clicks on the icon it checks for the aircraft title and panel. If the aircraft selected does not match the title, then the icon is removed and the panel is closed.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.