Jump to content
Sign in to follow this  
Guest zip

Current panel ID

Recommended Posts

Guest zip

This is a for a C gauge.Working on an auto-close function for a panel (such as, click the "x" and panel is toggled off). Easy to do if you know the ID of the panel. In my case, the panel is a custom panel, and it does not have an "ident" line in panel.cfg.An internal ID is no doubt assigned to it, but I need to know what it is at runtime.I suspect it's in a PELEMENT somewhere passed to the main loop, or perhaps as an event.Anyone know of a quick method to retrieve the panel ID at runtime?Cheers,

Share this post


Link to post
Share on other sites
Guest bartels

If it hasn't an ident line, add one. Check the gauges.h of the Panel SDK which are predefined and use one of them or a different numeric value. If you know the ID you can also work with the new functions is_panel_window_visible_ident and panel_resource_string_get (whatever this function does).Arne Bartels

Share this post


Link to post
Share on other sites
Guest zip

Thanks Arne,I suspected you'd jump on this (waiting for J.O.) :)Placing an ID in the panel.cfg does make it easy and is the obvious way, but it also hardcodes the gauge to a specific panel ID, something I'd like to avoid, especially if the same gauge appears on multiple panels with different IDs.Granted, I can pass the ID of the panel to the gauge as a parameter in the panel.cfg file, but I was seeking to avoid having to do this. I was thinking to extract the ID of the containing panel directly during the gauge initialization via the main callback routine, during one of the following events:#define PANEL_SERVICE_PRE_QUERY 0#define PANEL_SERVICE_POST_QUERY 1#define PANEL_SERVICE_PRE_INSTALL 2 // extra_data = resource_handle#define PANEL_SERVICE_POST_INSTALL 3 // extra_data = resource_handle#define PANEL_SERVICE_PRE_INITIALIZE 4#define PANEL_SERVICE_POST_INITIALIZE 5#define PANEL_SERVICE_PRE_UPDATE 6#define PANEL_SERVICE_POST_UPDATE 7#define PANEL_SERVICE_PRE_GENERATE 8 // extra_data = phase#define PANEL_SERVICE_POST_GENERATE 9 // extra_data = phase#define PANEL_SERVICE_PRE_DRAW 10#define PANEL_SERVICE_POST_DRAW 11#define PANEL_SERVICE_PRE_KILL 12#define PANEL_SERVICE_POST_KILL 13#define PANEL_SERVICE_CONNECT_TO_WINDOW 14 // extra_data = PANEL_WND#define PANEL_SERVICE_DISCONNECT 15 // extra_data = PANEL_WND#define PANEL_SERVICE_PANEL_OPEN 16#define PANEL_SERVICE_PANEL_CLOSE 17The questions are thus:- can a gage determine at runtime what panel it belongs to through the callback routine? (from the service_connect event, we can get the PANEL_WND) so I guess the answer is yes. - can this panel handle be converted to the ID usable in the KEY_PANEL_TOGGLE event (takes the ID as a parameter to toggle the said panel)?

Share this post


Link to post
Share on other sites

Did you have any luck with this? I can get the panel entry key and hWnd from the gauge header, but not the name of Window. I've tried calling GetWindowText() on the hWnd but this returns nothing.Anyone have any ideas?Andrew


Andrew Wilson

sig_fslDeveloper.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...