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.

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

I also have this issue with my G36 Improvement Project, loaded or unloaded. It
would be great for the panel to load per aircraft.

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

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

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: Being
able to dynamically turn off panels when not required was the main reason of
my suggestion.

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.

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.

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.