Jump to content
Sign in to follow this  
dragonflightdesign

Faking a mouse-click...

Recommended Posts

Does anyone know if it's possible to trigger a mouse-click event from code in C-gauges? Say, from the panel_update section? I'm that close to making the default panel lighting system do what I want it to do i.e. light only the gauges I want it to light but I have to use a mouse-click as part of the trigger system. I don't know why it won't work if I use a millisecond timer; it just doesn't.-Dai

Share this post


Link to post
Share on other sites

I have had some luck changing gauge DRAW_FLAGS on the fly by using the SET_OFF_SCREEN( element ) macro to force a redraw.Doug

Share this post


Link to post
Share on other sites
Guest mgipson

To be safe I found that I had to do the SET_OFF_SCREEN for 2 updates, otherwise the redraw would not always take place.

Share this post


Link to post
Share on other sites

I wish it was that easy, Doug. In a way that I simply don't understand, the action of a mouse-click is fundamental to whatever is going on down somewhere inside FS. Put simply, so far:-If a gauge has no power applied and the panel lights are turned on via the switch (mouse-click), it doesn't get lit.If the lighting system is off and I apply power to a gauge, then turn the panel lights back on via the switch (mouse-click), it lights up.The missing bit is:If the gauge light is on and power fails, the 'off' code is executed and ignored. If I 'fake' the power failure by turning it off via a mouse-click, it works; hence the reason for wanting to be able to fire a mouse-click via a variable.-Dai

Share this post


Link to post
Share on other sites

Well, I use trigger_key_event() all the time in the PANEL_SERVICE_PRE_UPDATE case. I do this because I use "custom XML code" in the model and gauge system so that I can synchronize the 2d panel and VC panel lighting. By forcing both LANDING LIGHTS and TAXI LIGHTS busses to remain "hot" all the time, I'm able to achieve my goals Note that the landing_lights variable is obtained in the "lookup_variables(); function: case PANEL_SERVICE_PRE_UPDATE: /* Fetch/Update Variables */ lookup_variables(); check_time_of_day(); if ( landing_lights == 0 ) { trigger_key_event(KEY_LANDING_LIGHTS_TOGGLE,0) ; } if ( taxi_lights == 0 ) { trigger_key_event(KEY_TOGGLE_TAXI_LIGHTS,0) ; } LandingLight_Left_id = check_named_variable ( "LandingLight_Left" ) ; set_named_variable_value ( LandingLight_Left_id, (FLOAT64)landinglight_left ) ; TaxiLight_Left_id = check_named_variable ( "TaxiLight_Left" ) ; set_named_variable_value ( TaxiLight_Left_id, (FLOAT64)taxilight_left ) ; LandingLight_Right_id = check_named_variable ( "LandingLight_Right" ) ; set_named_variable_value ( LandingLight_Right_id, (FLOAT64)landinglight_right ) ; TaxiLight_Right_id = check_named_variable ( "TaxiLight_Right" ) ; set_named_variable_value (TaxiLight_Right_id, (FLOAT64)taxilight_right ) ; break;


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Thanks for the input, guys. I guess I need to go away and have a re-think... or abandon the idea! :)-Dai

Share this post


Link to post
Share on other sites

>Thanks for the input, guys. I guess I need to go away and>have a re-think... or abandon the idea! :)Don't do the latter. Outline what you want to accomplish and either post it here, or send to me at n4gix@comcast.net and I'm sure it can be sorted out... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Hi BillMany thanks for the offer; I did finally manage to fix it this morning but I think my solution is inelegant and could do with an overhaul as it now relies on all macros having a callback function. I've started a new thread (SET_OFF_SCREEN) as I think the answer to that may be the answer to my current brute-force approach. Also, I want to put the information in the next issue of sd2gau, so I thought a new thread might be best.-Dai

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