October 21, 201015 yr I am stymied by what I guess is an XML syntax problem trying to enter string data into a gps variable through keyboard direct entry.The following is my code: <Gauge Name="Direct Entry 1" Version="1.0"><Size X="500" Y="310" /> <Macro Name="c">C:fs9gps</Macro> <Macro Name="C">C:fs9gps</Macro> <Update Frequency="18" Hidden="No"><!-- The following commented out line works ... the letter A is entered into the gps vaiable IcaoSearchStartCursor --> <!-- 'A' (>@c:IcaoSearchStartCursor) --> <!-- However, I want to enter the letter using keyboard direct entry, but the following does not correctly enter the keyboard entry into the gps variable ... --> ( (L:char21,enum) chr ) (>@c:IcaoSearchStartCursor) </Update> <Element> <Position X="0" Y="0"/> <Rectangle Width="500" Height="310" FillColor="gray" /> </Element> <!-- The keyboard entered character is correctly displayed --> <Element Name="IcaoSearchStartCursor 1"> <Position X="245" Y="62" /> <FormattedText X="245" Y="25" Adjust="left" Font="Courier New" FontSize="14" Color="#111111" Bright="Yes"> <String>%( (L:char21,enum) chr )%!s!%</String> </FormattedText> </Element> <Mouse> <Area Top="60" Left="240" Width="250" Height="20"> <Cursor Type="Hand" /> <Click Kind="LeftSingle"> (L:AsciiEntryEnable2, bool) ! (>L:AsciiEntryEnable2, bool) </Click> </Area> </Mouse><!-- This keyboard direct entry works as expected ... --> <Keys> <On Key="Ascii"> <Visible>(L:AsciiEntryEnable2, bool)</Visible> (M:Key) (>L:char21,enum) </On> </Keys></Gauge> The line ( (L:char21,enum) chr ) (>@c:IcaoSearchStartCursor) isn't working as I had hoped. If I type the letter A on the keyboard, its ascii value is correctly stored in L:char21,enum using <Keys> <On Key="Ascii"> <Visible>(L:AsciiEntryEnable2, bool)</Visible> (M:Key) (>L:char21,enum) </On></Keys> Furthermore, I can display the letter A in the Element <Element Name="IcaoSearchStartCursor 1"> <Position X="245" Y="62" /> <FormattedText X="245" Y="25" Adjust="left" Font="Courier New" FontSize="14" Color="#111111" Bright="Yes"> <String>%( (L:char21,enum) chr )%!s!%</String> </FormattedText></Element> but, I can't figure out how to store that keyboard entry string ('A') into the gps variable IcaoSearchStartCursor.Any ideas?Thanks,Bob
October 24, 201015 yr Commercial Member Try this, not tested but I think it should work. 'A' (>C:fs9gps:IcaoSearchStartCursor)31 (>C:fs9gps:enteringInput)(L:char21,enum) chr (>C:fs9gps:IcaoSearchEnterChar) Put it in your Update string but you ought to add some clauses to keep it from continuously firing.Or perhaps you could just put it in the click code.I would recommend using L:char21,number as oppose to enum aswell - I read and have been told that enum and bool are better suited to lower numerical computations.Hope that helps. Good Day, Engjell Berisha
October 24, 201015 yr Author Thanks! ... the 3rd line of your response contains the solution I was after. It seems so obvious after you see at the correct syntax...I needed: (L:char21,enum) chr (>@c:IcaoSearchStartCursor) not: ( (L:char21,enum) chr ) (>@c:IcaoSearchStartCursor) The double parens were the error. I think I'll move the code from the <Update> section to the <On Key="Ascii"> section, such as (M:Key) d (>L:char21,enum) chr (>@c:IcaoSearchStartCursor) (I want the entry stored in an LVar as well as entered into IcaoSearchStartCursor)Because I'm not working with the gps500 gauge, I don't need the enteringInput function.Thanks again,Bob
October 24, 201015 yr Commercial Member Thanks! ... the 3rd line of your response contains the solution I was after. It seems so obvious after you see at the correct syntax...I needed:(L:char21,enum) chr (>@c:IcaoSearchStartCursor) not: ( (L:char21,enum) chr ) (>@c:IcaoSearchStartCursor) The double parens were the error. I think I'll move the code from the <Update> section to the <On Key="Ascii"> section, such as (M:Key) d (>L:char21,enum) chr (>@c:IcaoSearchStartCursor) (I want the entry stored in an LVar as well as entered into IcaoSearchStartCursor)Because I'm not working with the gps500 gauge, I don't need the enteringInput function.Thanks again,Bob Actually I think ( (L:char21,enum) chr ) should work but I don't think you can put the spaces, or maybe I'm wrong. I'll test it if I get a chance but I think ((L:char21,enum) chr) or ((L:char21,enum) chr ) should work.What is enteringinput anyway? I've always been told to use it, that wasn't from the gps 500 either it was from a gauge I built. Good Day, Engjell Berisha
October 24, 201015 yr Moderator Actually I think ( (L:char21,enum) chr ) should work but I don't think you can put the spaces, or maybe I'm wrong. I'll test it if I get a chance but I think ((L:char21,enum) chr) or ((L:char21,enum) chr ) should work.What is enteringinput anyway? I've always been told to use it, that wasn't from the gps 500 either it was from a gauge I built."entering input" allows you to type a continuous string of characters at once, rather than one at a time. Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
October 25, 201015 yr Commercial Member "entering input" allows you to type a continuous string of characters at once, rather than one at a time.That would make sense, because my gauge won't work without it. Thank You Bill.Reading material on entering input is hard to find it seems, would you know if any?Why do I set it to 31? I've seen this in several gauges I learned to use it from and that's the only reason I've continued to do so - because it works. Good Day, Engjell Berisha
October 26, 201015 yr Author Why do I set it to 31?What the heck, I’ll take a stab at that. To the reader first of all, I'm pretty much a beginner and I'm writing this out to see If I have it right, hoping that someone will point out things to me that I have gotten wrong.Within the gps_500 gauge, it appears to me that the enteringInput value is simply associated with the particular type of data the gps_500 user is inputting. The enteringInput number is used to direct the Icao transfer to the appropriate type of data. For example, look at gps_500 lines 408 through 414. Depending upon which number has been stored in enteringInput, the ICAO search result IcaoSearchCurrentIcao or NameSearchCurrentIcao (this search is initiated through the users’ input to/interaction with the gps_500 gauge) is ‘transferred’ to the appropriate Waypoint type. The enteringInput value 10 causes IcaoSearchCurrentIcao to be transferred to, or stored as, WaypointAirportICAO since Airport information was entered by the user. 31 is used for FacilityICAO. In the gps_500 gauge, the user does not enter the value for enteringInput. The gauge does that for you based on which screens or pages you have navigated to through manipulation of the gps buttons or knobs. As an example, if I open up the gps_500 gauge and left click the upper right knob click arrow, the WPT screen opens with the APT page showing. If I next press PUSH CRSR, the airport ident is highlighted and flashes. If I want to change that ident, then left clicking the lower left or right knob arrow will initiate it. As soon as I left click the lower left or right knob, the gps gauge automatically stores 10 into enteringInput. At this point, I can enter new airport ident characters through direct keyboard input or through mouse clicks of the lower and upper knob arrows. When input is entered using the mouse and knob, the lower left and right click areas will scroll through the alphabet and numbers by incrementing +1 or -1 the gps variable IcaoSearchAdvanceCharacter. See gps_500 lines 3831 and 3832 for example. When the upper left or right knob click area is clicked, the blinking cursor moves to the next character position (or backwards) by incrementing IcaoSearchAdvanceCursor, ready for entry of the next letter or number. See lines 3757 and 3758 for example. IcaoSearchAdvanceCursor and IcaoSearchAdvanceCharacter variables control the cursor and the alphabet. For a second example, open the gps_500, left click the upper right knob then left click the lower right knob 4 times. The Waypoint screen is now opened to the Intersection page. Next, pressing PUSH CRSR followed by clicking the lower left or right knob will cause the number 11 to be automatically entered into enteringInput. That’s the appropriate value for WaypointIntersectionICAO (line 409). Entering characters or numbers through direct keyboard entry I find to be a little different, however, and here is where my observations of the gps dll differ from the comment that enteringInput allows you to type a continuous string of characters at once rather than one at a time. I first note that in the gps_500 gauge, keyboard entry only directly affects IcaoSearchEnterChar (line 3945) or NameSearchEnterChar (line 3949). That is to say, the individual keystroke entry is stored into IcaoSearchEnterChar or NameSearchEnterChar. If I am typing information related to Icao search, then gps_500 line 3945 directs the keystroke entry into IcaoSearchEnterChar. As I type, IcaoSearchEnterChar receives the keystroke one letter or number at a time. When a subsequent character is typed, it overwrites the previous entry. Slen is always 1. But simultaneous with this, note that IcaoSearchCurrentIdent automatically builds a continuous string of the characters as I type them, up to a maximum of 5 characters (five characters is the string length of an intersection ident – the longest ident string in FS). If a sixth character is entered, then the previous character is replaced by that and the first four do not change. enteringInput is not required to be in the code for this to happen. The gps ‘gauges’ that I am presently writing are rather unsophisticated I/O templates that I use to enter input and then watch what the gps dll does (this is where I make use of GPSViewer). I do not use any of the gps_500 functions like enteringInput. Often, I don’t even have the gps_500 gauge in the panel when I’m experimenting with the gps module.When it comes to Name searches in the gps_500, line 3949 directs the keystroke entry into NameSearchEnterChar, one character at a time just like IcaoSearchEnterChar. Simultaneously, NameSearchCurrentName automatically builds a continuous string of the characters as I type them up to a maximum of 80 characters. Once again, enteringInput is not needed. If more than 80 characters are entered, then the previous, the last, entry is replaced, similar to above.Essentially simultaneous with all of that, the building blocks of the Icao (which can include the single letter IcaoSearchStartCursor, the two letter IcaoSearchCurrentIcaoRegion, IcaoSearchCurrentIdent) are assembled by the gps module to form IcaoSearchCurrentIcao and if a match with an actual Icao is found, then IcaoSearchMatchedIcaosNumber is set to 1 (possibly more) and the Icao is ‘transferred’ to the appropriate Waypoint type via gps_500 lines 408 – 414. I note that the comment on line 407 reads “update pages while typing”, but enteringInput isn’t behind that.Anyway, that’s my two cents worth based on limited observation of the gps module in action.Cheers, Bob
Create an account or sign in to comment