Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I m trying to figure out the proper way to write codes to have the values displaying in text with values of 1 and 0 -- IE Warning indicator, on and off indicator.

Now let start with master Switch-- The codes I wrote

Dim Master as Boolean

Call FSUIPC_Read(&H2E80, 4, VarPtr(Master), dwResult)

Call FSUIPC_Process(dwResult)

If Master = True Then

MasterLightOn.Caption = Format(Master, "Master ON")

Else

Master = False

End If

When I complie it, it shows no error... When running with FS2002.. The display text on my application dont seem to show anything when switching on/off on a cessna panel from FS2002... Would anyone know what went wrong? did I implement the code correctly? and what are your suggestion?

Thanks in Advance

P.S. I m kinda of doing this in haste... This project that I am working on is in regard for my final exam at college. (Due in 3 weeks from now)

Posted
If Master = True Then

MasterLightOn.Caption = Format(Master, "Master ON")

Else

Master = False

End If

I don't know VB, but it looks like you are setting the variable Master to FALSE when it is FALSE. Why? Where do you change the Caption to "OFF"?

Regards,

Pete

Posted

Arthur:

Dim Master as Boolean 

Call FSUIPC_Read(&H2E80, 4, VarPtr(Master), dwResult) 
Call FSUIPC_Process(dwResult) 

If Master = True Then 
MasterLightOn.Caption = Format(Master, "Master ON") 
Else 
Master = False 
End If 

Try this...

Dim Master as Boolean 

Call FSUIPC_Read(&H2E80, 4, VarPtr(Master), dwResult) 
Call FSUIPC_Process(dwResult) 

If Master = True Then 
MasterLightOn.Caption = "Master ON"
Else 
MasterLightOn.Caption = "Master OFF"
End If 

In the 'Else' condition, instead of setting MasterLightOn.Caption to "Master OFF" if Master was False, you were just setting Master to False if it was already false - ie doing nothing.

Richard

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
×
×
  • Create New...

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.