August 8, 200619 yr Commercial Member 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
August 8, 200619 yr 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
August 8, 200619 yr 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.
August 8, 200619 yr Author Commercial Member 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
August 8, 200619 yr Moderator 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
August 8, 200619 yr Author Commercial Member Thanks for the input, guys. I guess I need to go away and have a re-think... or abandon the idea! :)-Dai
August 8, 200619 yr Moderator >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 [email protected] and I'm sure it can be sorted out... ;) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
August 9, 200619 yr Author Commercial Member 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
Create an account or sign in to comment