• 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.

Checking if a 2D panel is open.

Messages
1,130
Country
australia
I'm really just putting this here for my own future references as I am sure I will forget this and I couldn't find anything similar by searching.

To find out if a 2D panel is open use the C function is_panel_window_visible_ident. It will return 1 of true and 0 if false.

For example:
Code:
config_is_open = is_panel_window_visible_ident(IDENT_MAIN_PANEL);
The ident is specified in the panel.cfg aircraft for each 2D window. For example:
ident=MAIN_PANEL


The definitions are from fsxgauges_sp2.h:
Code:
// Panel identifiers
#define IDENT_MAIN_PANEL                        0
#define IDENT_MAIN_PANEL_ALT1                    1
#define IDENT_MAIN_PANEL_ALT2                    2
#define IDENT_MAIN_PANEL_ALT3                    3
#define IDENT_MAIN_PANEL_ALT4                    4
#define IDENT_MAIN_PANEL_ALT5                    5
#define IDENT_MAIN_PANEL_ALT6                    6
#define IDENT_MAIN_PANEL_ALT7                    7
#define IDENT_MAIN_PANEL_ALT8                    8
#define IDENT_MAIN_PANEL_ALT9                    9
#define IDENT_THROTTLE_PANEL                    10
#define IDENT_RADIO_STACK_PANEL                 50
#define IDENT_COMPASS_PANEL                     75
#define IDENT_MINI_CONTROLS_PANEL               100
#define IDENT_ANNUNCIATOR_PANEL                 125
#define IDENT_ANNUNCIATOR2_PANEL                150
#define IDENT_IFR_MAIN_PANEL                    175
#define IDENT_COLLECTIVE_PANEL                  200
#define IDENT_GPS_PANEL                         225
#define IDENT_OVERHEAD_PANEL                    250
#define IDENT_PARKING_BRAKE_PANEL               251
#define IDENT_FLAPS_TRIM_PANEL                  252
#define IDENT_FUEL_PANEL                        253
#define IDENT_ELECTRICAL_PANEL                  254
#define IDENT_TRIM_PANEL                        255
#define IDENT_LANDING_GEAR_PANEL                256
#define IDENT_MISC_POPUP_1                      260
#define IDENT_MISC_POPUP_2                      261
#define IDENT_MISC_POPUP_3                      262
#define IDENT_MISC_POPUP_4                      263
#define IDENT_MISC_POPUP_5                      264
#define IDENT_MISC_POPUP_6                      265
#define IDENT_MISC_POPUP_7                      266
#define IDENT_MISC_POPUP_8                      267
#define IDENT_MISC_POPUP_9                      268
#define IDENT_MISC_POPUP_10                     269


#define IDENT_USER                              10000
#define IDENT_USER_MAX                          19999

#define MIN_HUD_IDENT                           20000
#define IDENT_AIRCRAFT_HUD_3D_PANEL             20000
#define IDENT_HELICOPTER_HUD_3D_PANEL           20001
#define IDENT_CONTROLS_HUD_3D_PANEL             20002
#define IDENT_TEXT_HUD_3D_PANEL                 20003
#define IDENT_DAMAGE_HUD_3D_PANEL               20004
#define IDENT_SCORE_HUD_3D_PANEL                20005
#define MAX_HUD_IDENT                           20006

#define IDENT_LSO_WINDOW                        22000
#define IDENT_POI_WINDOW                        22001
#define IDENT_TIMER_WINDOW                      22002
#define IDENT_DROPPABLE_OBJ_WINDOW              22003


#define IDENT_INVALID                           4294967295

Note how in the C gauge you need to prefix IDENT_

If you want to use your own ident in the panel.cfg then make sure it is in the range 10000 to 19999. For example in the panel.cfg you can use:

ident=15533

and in the C gauge use:

Code:
config_is_open = is_panel_window_visible_ident(15533);
 
The above would make a terrific addition to the Wiki also... ;)
 
I guess I'm lucky to program gauges in XML.
Using a module with a simular view_status function, by Doug Dawson, since 2006.

Sorry, just mentioning it ......

Cheers, Rob
 
I thank you for the click code change suggestion and I will implement that as soon as I reply here. Karel's xml works perfectly and does exactly what I want. Open RH/Close LH and vice-versa with just an icon click. I created my own bmps for a control strip that is visible when startup like other payware panels do since it is inconvenient to do [SHIFT X] clicks when flying and remember which X does what screen. I have done this in other aircraft as well. Thank you so much all of you for the help I so desperately need in XML. This takes care of this thread for me.
 
Back
Top