- Messages
- 1,564
- Country

Following up on discussion of the use of sting storing macros in this FSDeveloper thread (http://www.fsdeveloper.com/forum/showthread.php?t=157527) (see post 19 onwards), the attached XML gauge demonsrates use of the macros when entering text from either the pc keyboard, or using mouse clicks on a simulated FMS gauge keyboard. Credit and thanks to Tom Aguilo and Joao Muas for their work and solutions.
The attached gauge is fully functional, written using FS9 syntax but also useable in FSX, and intended to be set up as a separate x=245, y=270 windowed gauge for demo purposes. Instructions are included in the gauge.
The topic of storing strings is discussed in the FSDeveloper Wiki (http://www.fsdeveloper.com/wiki/index.php?title=Xml:_storing_strings) and in this thread http://www.fsdeveloper.com/forum/showthread.php?t=94088. There are several approaches to storing strings, including excellent solutions provided by Doug Dawson, Roman Stoviak, and Robbie McElrath, among others. The attached XML gauge uses Robbie McElrath's macros that can be used to store string data up to 64 characters long as a "single" L:Var.
L:Vars can only store numbers, not strings, so the ascii equivalent of the character is used. Behind the scenes, the macros actually construct sixteen L:Vars containing 4 alphanumeric characters each by utilizing the ascii hexadecimal value of each character together with XML's built in Bit Operators (>>, <<, |, &) to keep track of the order. << and & are used instead of << and & to keep the XML parser happy. The Read4, Write4, etc.. macros each create 4 L:Vars, and the Read macros just expand to 4 copies of the name4 macros, which gives 16 total. The L:Vars are subsequently concatenated using XML String Operators chr and scat to form a string up to 64 characters long.
The user chooses an arbitrary name which is attached to the 16 L:Vars as a prefix, uniquely labeling them (name_[1-4]_[1-4]). The 16 building block L:Vars are never shown individually, and just one L:Var name (prefix) is entered. To the user, the appearance is that a single L:Var holds a string up to 64 alphanumeric characters long.
Cheers,
Bob
The attached gauge is fully functional, written using FS9 syntax but also useable in FSX, and intended to be set up as a separate x=245, y=270 windowed gauge for demo purposes. Instructions are included in the gauge.
The topic of storing strings is discussed in the FSDeveloper Wiki (http://www.fsdeveloper.com/wiki/index.php?title=Xml:_storing_strings) and in this thread http://www.fsdeveloper.com/forum/showthread.php?t=94088. There are several approaches to storing strings, including excellent solutions provided by Doug Dawson, Roman Stoviak, and Robbie McElrath, among others. The attached XML gauge uses Robbie McElrath's macros that can be used to store string data up to 64 characters long as a "single" L:Var.
L:Vars can only store numbers, not strings, so the ascii equivalent of the character is used. Behind the scenes, the macros actually construct sixteen L:Vars containing 4 alphanumeric characters each by utilizing the ascii hexadecimal value of each character together with XML's built in Bit Operators (>>, <<, |, &) to keep track of the order. << and & are used instead of << and & to keep the XML parser happy. The Read4, Write4, etc.. macros each create 4 L:Vars, and the Read macros just expand to 4 copies of the name4 macros, which gives 16 total. The L:Vars are subsequently concatenated using XML String Operators chr and scat to form a string up to 64 characters long.
The user chooses an arbitrary name which is attached to the 16 L:Vars as a prefix, uniquely labeling them (name_[1-4]_[1-4]). The 16 building block L:Vars are never shown individually, and just one L:Var name (prefix) is entered. To the user, the appearance is that a single L:Var holds a string up to 64 alphanumeric characters long.
Cheers,
Bob
Attachments
Last edited:



