![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
|
|
04-21-10, 09:58 AM
|
#1 |
|
Black Magic
![]() |
try this for debugging purposes:
def AOBFToggle( sender ): global AOBFswitch AOBFswitch = not AOBFswitch # show the state of the switch for debugging purposes ScriptManagerManaged.ShowPythonError( "AOBFswitch=" + str(AOBFswitch) ) Pageattackperiscope_RAOBF.Visible = AOBFswitch this will show a dialogbox saying AOBFswitch= either true or false so you can see if the switch is really toggling or not. |
|
|
04-21-10, 12:26 PM
|
#2 | |
|
sim2reality
![]() Join Date: Jun 2007
Location: AM 82
Posts: 2,288
Downloads: 262
Uploads: 31
|
EDIT: Just tried it out and my code was useless, but the same code for the switch works perfectly.
![]() CODE] Quote:
Was just coming to post to say I got it working when I seen your reply theDarkWraith. There was nothing wrong with the code at all .It was my layers order in the Menu Editor the Switch Toggle Button was under the actual Dial layer. That meant when the switch was toggled the Dial appeared but as the button was under the Dial layers tranparent section, it was basically masked of from being clicked again .Wasted a full day trying to figure that one out. ![]() Thanks for the debug code, I was just using basic messages in debug code to show what part of the script i'm in didn't relise you make it display the actual string: ("AOBFswitch=" + str(AOBFswitch) ) Will make use of that in the future. Cheers ![]() @TheDarkWraith While this code works for a Toggle button [Bt] - The switch will always defauls to it standard graphic state If one wanted to do a on/off buttonn you would need to use a checkbox [Ck] instead of a button so then: 1st click on - (Display on state Graphic) 2nd click off -(Display off state Graphic)....etc What type code would be needed for that? would it be similar to above. Eg. Code:
def AOBFToggle( sender ): if AOBFToggle = True: Pageattackperiscope_RAOBF.Visible = True elif AOBFToggle = False: Pageattackperiscope_RAOBF.Visible = False Last edited by reaper7; 04-21-10 at 01:49 PM. Reason: Solution found |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
