Sign in to follow this  
n4gix

Howto pass mouse events for two gauges?

Recommended Posts

I made a gauge that adds funcionalities for an almost dummy button. My gauge detects a mouse click and perform some actions, however the dummy gauge under my gauge must also receive the mouse click. As far I understood putting my gauge over the button blocks the mouse detection for the button. Is it possible to have both gauges receiving the mouse event?ThanksJos

Share this post


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

Not directly. If both gauges are part of the same multigauge you can use variables that are accesable from both gauges though. You could use the same mouse function for both gauges, etc..Arne Bartels

Share this post


Link to post
Share on other sites

Hey Jose,Arne is right, easiest way is to use the same mouse function in the MOUSE_CHILD_FUNCT for the second gauge.

Share this post


Link to post
Share on other sites

Thanks, the gauges are distinct. It seems that I will have to intercept the mouse messages or make a direct input function and check it instead of using the MOUSE_CHILD_FUNCT. Jos

Share this post


Link to post
Share on other sites

>Thanks, the gauges are distinct. It seems that I will have to>intercept the mouse messages or make a direct input function>and check it instead of using the MOUSE_CHILD_FUNCT. Why not simply pass the event via a broadcast variable to your 'dummy gauge?' The 'dummy gauge' could then execute whatever function you want based on the bool value of the received variable... :)

Share this post


Link to post
Share on other sites

I'm new to gauge programming but from my other (real?) job, I'd try to use a windows message and send it to the handle of the second gauge (message forwarding). That's commonly done with cascading controls. The only thing you need to know is how FS9 handles messages but redirect the target.Of course, it implies you can trap the message through the linkage, perhaps through a registered panel var?

Share this post


Link to post
Share on other sites

That's too complicated a solution to a trivial problem.In the 'transmitting gauge,' simply create a 'broadcast' (i.e. shared) variable: for example, master_warnIn the 'receiving gauge,' create a 'receive' variable with the same name as before, but prefixed with an asterisk, e.g., *master_warn," as well as a local version of the same variable, "warn_on."To 'bullet proof' the code and prevent any errors, simply check that the memory location actually has the value stored from the broadcast gauge:if ( master_warn != NULL ) { warn_on = *master_warn ; }the later on,if warn_on = 1 { do something } else { do something else ; }

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