Archived

This topic is now archived and is closed to further replies.

n4gix

Get the current view in FSX

Recommended Posts

I am trying to know what view is currently used in FSX (2D, VC or other). In fs9, I could use "ACTIVE VIEW MODE", but this does not work in FSX. Bill suggested to associate an ident to the [VCockpitXX] section and check if they are visible with "is_panel_visible_window_ident", but this does not work either.I someone has another solution, I would be happy to know about it :)Eric

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi EricI'm successfully using the "is_panel_visible_window_ident" method to detect whether a given panel is open and if it is, to ensure that all associated sub-panels are closed when the parent panel is closed. So the question is, are you getting an error or does it simply not work for you?-Dai

Share this post


Link to post
Share on other sites

I also used this function several times, and it has always worked fine on fs9 and FSX, for the 2D panel windows. The problem here is that it does NOT work for virtual cockpit. In fact, it returns "false" even when the virtual cockpit is visible.For information, here is what I have in the [VCockpitXX] section of the panel.cfg:[VCockpit01]size_mm=512,512pixel_size=512,512texture=$XXXbackground_color=0,0,0ident=12000gauge00=...Whatever happens, "is_panel_visible_window_ident(12000)" always returns "false", even when the VC is visible.Eric

Share this post


Link to post
Share on other sites

> virtual cockpitWell, that'll teach *me* to read the topic correctly. I've never tried closing the VC window from code.... "sorry" for getting your hopes up.-Dai

Share this post


Link to post
Share on other sites

Hello Dai,I'm sorry to say that you should read the topic again ;-) I am not trying to close the VC window from code (this would be quite strange), I am just trying to know if the VC is visible or not. IOW, I am trying to know if the user is in 2D panel mode, Virtual Cockpit mode, or other (spot, tower, ...).Eric

Share this post


Link to post
Share on other sites

As I've stated previously, anytime the 2d panel ident=0 isn't visible, the VC is loaded and active.I've always used this as my test:if ( !is_panel_window_visible_ident(0) ){ vc_active = 1 ; }else{ vc_active = 0 ; }Among other things, I've used this technique to shut down GDI+ gauge drawing whenever they aren't being used.By sending the same flag to an XML L:var,unit I've also used it to suspend XML gauge drawing taking place... ;)

Share this post


Link to post
Share on other sites

>As I've stated previously, anytime the 2d panel ident=0 isn't>visible, the VC is loaded and active.>Sorry Bill, this is not true...If you press the W key, you get the mini-panel view. The 2D main panel is not visible, and the VC is not visible either ;-)I guess you don't use the mini-panel very often, but if , like me, you were a happy user of the head-up displays (HUD) from SimScape, you would use it more often.Eric

Share this post


Link to post
Share on other sites

>>As I've stated previously, anytime the 2d panel ident=0>isn't>>visible, the VC is loaded and active.>>>>Sorry Bill, this is not true...>If you press the W key, you get the mini-panel view. The 2D>main panel is not visible, and the VC is not visible either>;-)>>I guess you don't use the mini-panel very often, but if , like>me, you were a happy user of the head-up displays (HUD) from>SimScape, you would use it more often.Then include a check for ident=100 (which is the actual id for the MINIPANEL)......or IDENT_MINI_CONTROLS_PANEL...either one will tell you if the mini-panel window is active.

Share this post


Link to post
Share on other sites

Yes, I thought about this, and it solves the proble... partially. Because again, if the user swiches to spot view, the main panel and the mini-panel are not visible, but it does not mean the VC is visible. This is why I would like to test the visibility of the VC.But if it is not possible, I will use this workaround...EricPS. The ident for the mini-panel is not 100, it is 20000 :)

Share this post


Link to post
Share on other sites

>Yes, I thought about this, and it solves the proble...>partially. Because again, if the user swiches to spot view,>the main panel and the mini-panel are not visible, but it does>not mean the VC is visible. This is why I would like to test>the visibility of the VC.>>But if it is not possible, I will use this workaround...>>Eric>>PS. The ident for the mini-panel is not 100, it is 20000 :)Not according to the latest gauges.h file it isn't...20000 is the IDENT_AIRCRAFT_HUD_3D_PANEL!// Panel identifiers#define IDENT_MAIN_PANEL 0#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_USER 10000#define IDENT_USER_MAX 19999#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 IDENT_LSO_WINDOW 22000#define IDENT_INVALID 4294967295

Share this post


Link to post
Share on other sites

You should give it a try, and you would see I'm right :-)The content of gauhes.h often needs to be "decrypted".Eric

Share this post


Link to post
Share on other sites

>You should give it a try, and you would see I'm right :-)>The content of gauhes.h often needs to be "decrypted".Say what? What's in the gauges.h is simply a very straight-forward table that defines a 1:1 relationship between the "text name" and the actual numbers used......now I will grant you that not everything does work as expected, but still! :)

Share this post


Link to post
Share on other sites

>You should give it a try, and you would see I'm right :-)>The content of gauhes.h often needs to be "decrypted".>>Eric>You're wrong. The gauges.h defines the variable Bill mentioned as having a value of 100. No decryption required... zip, zilch, nada. However... the panel ID VALUE is defined in the panel.cfg file. It is something the USER can change at a whim.

Share this post


Link to post
Share on other sites

OK guys, sorry about this, I don't want to argue endlessly.I don't know why my code does NOT work when I use the ident 100, and it WORKS when I use 20000... But the most important is that it works, and that everyone is happy.Eric

Share this post


Link to post
Share on other sites