Jump to content
The simFlight Network Forums
hawkt1

vb.net detect value changes

Recommended Posts

Hello Paul,

FSUIPC related but more a question of vb, or more specifically the most productive way to achieve a result.

At present I have a textbox.text changed event which then triggers another sub routine.

However I want to get rid of the textboxes and detect when values change that I have pulled from fsuipc

So for example detect the com value change and then trigger an event

Dim nav1bcd As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H0350)Dim nav1String = ""nav1String = nav1bcd.Value.ToString("X4")
I did think a timer to check the value might be the best way but im sure thats not the most resource easy way to do that.

Need to monitor upto 40 different variables

Any thoughts?

Share this post


Link to post
Share on other sites

Hi,

 

Your timer loop idea is the only way it can be done.

 

You just have to keep reading the data and then compare the new values against the old ones that you've saved from the previous read. When you detect a change you can either fire your own event(s) or just call the appropriate subroutine(s) directly if you prefer.

 

Monitoring 40 variables like this won't cause you any performance or memory problems at all (you could easily do 400 if you wanted). 

 

Paul

Share this post


Link to post
Share on other sites

Thanks Paul for confirming that.

 

I think the best thing to do would be to literally compare the current value against the old value and then call the relevant sub routine to action, something like

Dim nav1 = 1
Dim nav1old  = ""

nav1old = nav1

if nav1 <> nav1old then
'do something
endif

Share this post


Link to post
Share on other sites

I will ask another question. Lets say we want to check pilots' actions during their flights and seatbelt sign is one of the check items. But the problem with the seatbelt offsets is many different aircraft have different offsets for seatbelt usage. For example,

standart seatbelt offset is 341D,

pmdg ngx 738 offset is 649F,

pmdg 777 ofset is 647B,

pmdg 747 offset is 6C2B.

And probably other addons are using different offset values also. Is there any way to detect which offset is activated when some switch is turned on or off?

Share this post


Link to post
Share on other sites
Quote

Is there any way to detect which offset is activated when some switch is turned on or off?

The only way is to monitor all the possible offsets and see which one changes.

There's no way I know of to get the addresses of offsets that change during a period of time.

Paul

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

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.