Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Freq Rotating Switch Question

Featured Replies

All,I'm having a problem with a freq switch that i can't get solved. I have a rotating switch as follows:<Gauge Name="UHF-FRAC" Version="1.0"> <Element> <Select> <Value>(L:UHF-FRAC, enum)</Value> <Case Value="0"> <Image Name="Knob_H_00.bmp" ImageSizes="40,41"/> </Case> <Case Value="1"> <Image Name="Knob_H_01.bmp" ImageSizes="40,41"/> </Case> <Case Value="2"> <Image Name="Knob_H_02.bmp" ImageSizes="40,41"/> </Case> <Case Value="3"> <Image Name="Knob_H_03.bmp" ImageSizes="40,41"/> </Case> <Case Value="4"> <Image Name="Knob_H_04.bmp" ImageSizes="40,41"/> </Case> <Case Value="5"> <Image Name="Knob_H_05.bmp" ImageSizes="40,41"/> </Case> </Select> </Element> <Mouse> <Cursor Type="Hand"/><Click>(L:UHF-FRAC, enum) 5 == if{ 0 (>L:UHF-FRAC, enum) } els{ (L:UHF-FRAC, enum) ++ (>L:UHF-FRAC, enum) }</Click> <Tooltip ID="">ROTATE FREQ DEC SWITCH</Tooltip> </Mouse></Gauge>When i click it the switch turns as advertised, only i want to couple it to the increase/decrease the frequency of the radio. I've tried to couple it to the following code but it does not work.<Gauge Name="UHF ROTATE + DECREASE" Version="1.0" Author="666"> <Update Frequency="4"/><!-- Radio Frequency Decrease --> <Element> <Select> <Value>(L:UHF-FRAC,enum) case if{(> K:COM_RADIO_WHOLE_DEC)} </Value> </Select> </Element></Gauge>Is there somebody out there to help me with this?Thanks in advance!Slammer

  • Moderator

If you want only one mouse area, then you need to set it up to detect left click and right click events:

<Mouse>  <Cursor Type="Hand"/>  <Click Kind="LeftSingle + RightSingle">	<!-- If the Right button is clicked, then increase knob rotation and freq. -->	(M:Event) 'RightSingle' scmp 0 ==	if{	  (L:UHF-FRAC, enum) ++ 5 min (>L:UHF-FRAC, enum)	  (>K:COM_RADIO_FRACT_INC_CARRY)	}	<!-- If the Left button is clicked, then decrease knob rotation and freq. -->	(M:Event) 'LeftSingle' scmp 0 ==	if{	  (L:UHF-FRAC, enum) -- 0 max (>L:UHF-FRAC, enum)	  (>K:COM_RADIO_FRACT_DEC_CARRY)	}  </Click>  <Tooltip>ROTATE FREQ DEC SWITCH</Tooltip></Mouse>

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author

Fr,Thanks for your help, it works fine. I only have one question:The switch contains 5 bitmaps, if decrease frequency bitmap disappears and if i increase beyond 5 the bitmap also disappears which is logical (given the 5 as maximum). Since it takes a lot of clicks to set the right freq i made 40 bitmaps. Is there an easier way to make a loop in this switch since 5 bitmaps covers 360 degrees? Thanks for your time and help! :( Ed

  • Moderator

I would only use ONE bitmap, and then "rotate" it something like this:

<Gauge Name="UHF-FRAC" Version="1.0">  <Element Name="Frequency Knob">	<Position X="346" Y="331"/>	<Image Name="Knob_H_00.bmp" Bright="Yes" PointsTo="North">	  <Axis X="20" Y="20"/>	</Image>	<Rotate>	  <Value>		<Value Minimum="0" Maximum="36">(L:UHF-FRAC, enum) 0 max 36 min</Value>	  </Value>	</Rotate>  </Element>  <Mouse>	<Cursor Type="Hand"/>	<Click Kind="LeftSingle + RightSingle">	  <!-- If the Right button is clicked, then increase knob rotation and freq. -->	  (M:Event) 'RightSingle' scmp 0 ==	  if{	  (L:UHF-FRAC, enum) ++ 36 min (>L:UHF-FRAC, enum)	  (>K:COM_RADIO_FRACT_INC_CARRY)	  }	  <!-- If the Left button is clicked, then decrease knob rotation and freq. -->	  (M:Event) 'LeftSingle' scmp 0 ==	  if{	  (L:UHF-FRAC, enum) -- 0 max (>L:UHF-FRAC, enum)	  (>K:COM_RADIO_FRACT_DEC_CARRY)	  }	</Click>	<Tooltip>ROTATE FREQ DEC SWITCH</Tooltip>  </Mouse></Gauge>

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author

Fr,Sorry, it doesn't show the bitmap. If i remove the <position> statement it will show the bitmap and changes the freq but doesn't turn the bitmap.RegardsEd

I see no need to use an additional variable (L:UHF-FRAC, enum) to animate the bitmap.A code like this is enough. <Element> <Position X="60" Y="116"/> <Image Name="Radio_COM_knob.bmp" PointsTo="East"> <Axis X="15" Y="15"/> </Image> <Rotate> <Value>(A:COM ACTIVE FREQUENCY:1, Megahertz) 10 *</Value> <Nonlinearity> <Item Value="0" Degrees="0"/> <Item Value="2" Degrees="360"/> </Nonlinearity> </Rotate> </Element>... <Mouse> </Area> <Area Left="20" Top="76" Width="80" Height="40"> <Area Right="40"> <Cursor Type="DownArrow"/> <Click Event="COM_RADIO_FRACT_DEC" Repeat="Yes"/> </Area> <Area Left="40"> <Cursor Type="UpArrow"/> <Click Event="COM_RADIO_FRACT_INC" Repeat="Yes"/> </Area> <Tooltip ID="TOOLTIPTEXT_COMM1_FREQ"/> </Area> </Mouse>Herbert

  • Moderator
I see no need to use an additional variable (L:UHF-FRAC, enum) to animate the bitmap.
You are correct, there is no (obvious) need in this specific case. I was simply showing a method to use his existing custom L:variable. If one understands the method, then it may be applied to any other general case.Is there some particular reason you didn't encapsulate your XML script example in the forum's

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
You are correct, there is no (obvious) need in this specific case. I was simply showing a method to use his existing custom L:variable. If one understands the method, then it may be applied to any other general case.Is there some particular reason you didn't encapsulate your XML script example in the forum's
 tags? Doing so preserves the formatting of the XML script, and also allows readers to quickly cut-and-paste the entire script from the [code] box...  :(Hi Bill,Neither did I want to criticize your code - it's exellent as usual - nor is there any particular reason for the appearance of my code. I simply copied and pasted it. In deed I also was surprised, why the formatting got lost on the way, bid did not think about that any longer... Next time I'll try to make it better.But I've allmost retired from creating panel and gauges and visit this forum only occasionally. So there might not come up too many posts getting a reply from me... :( Best regards,Herbert
  • Author

Bill & Herbert,Thank you very much for your interest in my problem and the solutions you've given me it really helped a lot. In the mean time (since i did not seet the bitmap using Bills last posted code, i dunno why!) i had a look at the FS2X tutorials and found the <nonlinearity> code and together with the click statement of Bill (thanks a lot) i made the following code that also solves the problem not showing the bitmap when minimum or maximum values are surpassed. It looks like this:<Gauge Name="UHF-FRAC" Version="1.0"> <Image Name="UHF_Background.bmp" ImageSizes="60,60" Luminous="1"/>//-------------------- <Element Name="Frequency Knob"> <Position X="60" Y="60"/> <Image Name="Knob_H_00.bmp" Bright="Yes"> <Axis X="30" Y="30"/> </Image> <Rotate> <Value>(L:UHF-FRAC, enum)</Value> <Nonlinearity> <Item Value="0" X="70" Y="50"/> <Item Value="1" X="90" Y="50"/> <Item Value="2" X="90" Y="70"/> <Item Value="3" X="70" Y="70"/> </Nonlinearity> </Rotate> </Element> <Mouse> <Cursor Type="Hand"/> <Click Kind="LeftSingle + RightSingle"> <!-- If the Right button is clicked, then increase knob rotation and freq. --> (M:Event) 'RightSingle' scmp 0 == if{ (L:UHF-FRAC, enum) ++ (>L:UHF-FRAC, enum) (>K:COM_RADIO_FRACT_INC_CARRY) } <!-- If the Left button is clicked, then decrease knob rotation and freq. --> (M:Event) 'LeftSingle' scmp 0 == if{ (L:UHF-FRAC, enum) -- (>L:UHF-FRAC, enum) (>K:COM_RADIO_FRACT_DEC_CARRY) } </Click> <Tooltip>ROTATE FREQ DEC SWITCH</Tooltip> </Mouse></Gauge>I also removed the min/max statements and the knob keeps on rotating left and right constantly showing the bitmap.Bill, thank you very much again for your great inputs. Without this I would be bold and have sleepless nights! Awsome...Regards Ed

  • Moderator
nor is there any particular reason for the appearance of my code. I simply copied and pasted it.
After copy/paste, reselect all the script, and then click the button on the far right end of the editor (tooltip says: "Wrap in code tags")
This text is wrapped in "code tags"	 so all the indenting  and					   other formattingis preserved...

:(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
<Gauge Name="UHF-FRAC" Version="1.0"><Image Name="UHF_Background.bmp" ImageSizes="60,60" Luminous="1"/>//--------------------<Element Name="Frequency Knob"><Position X="60" Y="60"/><Image Name="Knob_H_00.bmp" Bright="Yes"><Axis X="30" Y="30"/></Image><Rotate><Value>(L:UHF-FRAC, enum)</Value><Nonlinearity><Item Value="0" X="70" Y="50"/><Item Value="1" X="90" Y="50"/><Item Value="2" X="90" Y="70"/><Item Value="3" X="70" Y="70"/></Nonlinearity></Rotate></Element><Mouse><Cursor Type="Hand"/><Click Kind="LeftSingle + RightSingle"><!-- If the Right button is clicked, then increase knob rotation and freq. -->(M:Event) 'RightSingle' scmp 0 ==if{(L:UHF-FRAC, enum) ++ (>L:UHF-FRAC, enum)(>K:COM_RADIO_FRACT_INC_CARRY)}<!-- If the Left button is clicked, then decrease knob rotation and freq. -->(M:Event) 'LeftSingle' scmp 0 ==if{(L:UHF-FRAC, enum) -- (>L:UHF-FRAC, enum)(>K:COM_RADIO_FRACT_DEC_CARRY)}</Click><Tooltip>ROTATE FREQ DEC SWITCH</Tooltip></Mouse></Gauge>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.