RKG_buttons.gau
July 17, 2002 version 2.0
by Robert K. Guy
What's New
__________
V2.0 now runs under Windows 98/ME/2000/XP and is designed for FS2002 only.
This gauge was tested with WinXP with service pack 1 and Q306676 hot-fix
from Microsoft which includes a new D3D8.dll for Windows DirectDraw3D.
The Q306676 may not be required for all installations and fixes some
Video card related problems. The Q306676 hot-fix is available from the
WinXP update site at Microsoft.com. This gauge was tested with NVidia
geForce2 and geForce4 video cards.
This version (V2.0) is a drop-in replacement for previous versions of the
gauge - it will not break a panel designed for a previous version. The gauge
operation is identical to previous versions with the exception that some
new buttons have been added. The name of the gauge may
have to be changed if the designer of a panel has changed the name. It is
usually only necessary to put the gauge in the gauges folder overwriting
any previous version of the gauge. If the designer of the panel has
customized this gauge by changing any of the bitmaps then the bitmaps
in this version will need to be similarly changed.
This gauge may run with FS2000 or CFS2 when no key_id greater than 860 is
used. This version has not been completely tested with FS2000 and the
version 1.3 gauge can be used instead for FS2000. New key_ids have been
added (861..988) for FS2002 support. This gauge is a 'drop-in' replacement
for the previous (V1.3) gauge and will not break a panel designed for
FS2000 and then used in FS2002. If other developers or users have changed
the graphics in a previous version then the graphics will need to be changed
similarly in this version. Some new buttons have been added in this version:
Autothrottle arm
AutoStop
Flightmap
ATC
Kneeboard
Pushback
a 'Swap panels' 2-button set
A set of buttons gauge for FS2002 only.
____________________________________________
This gauge file contains: standard panel switching buttons, NAV/GPS, Autopilot and
Flight Director buttons, hidden buttons, programable On/Off buttons, and programable
toggle switches. The principal feature is that most buttons can have their key_id
reassigned by setting the parameter field (in the panel.cfg) so that a button can
operate any "thing" in MSFS that can respond to a key_id. This gauge set was
designed to replace multiple copies of single button gauges that are hard-coded
and to allow more flexible use of buttons. A second goal was to eliminate the need
to load a large gauge set just to use one button from it.
This gauge set is for FS2002 only, it contains no funky code that prevents
you from playing with it. You may rename it or replace or modify the
graphics. All of the bitmaps used are opaque and the buttons may be
placed on any background bitmap. The bitmap format is uncompressed Windows 256
color bitmap with a 256 byte palette. MSFS should be able to understand and use
any Windows compatible bitmap including compressed formats but this has not
been fully tested. It is best to ensure that replacement bitmaps are
exactly the same size and format as the originals in this gauge. Many third-party
editors produce bitmaps with 'short' palettes which may not have 256 bytes.
These 'short' bitmaps may cause Windows to crash.
This gauge set appears to work with FS2000 but it has not been completely tested.
It is safer to use the V1.3 gauge with FS2000.
All of these buttons share their code and resources - they effectively
become repeaters. When multiple instances of a single button are installed in
a panel all of the instances of that single button share their settings. A setting
on one button is repeated on the other. If a single button is installed
(in a panel) more than once, the parameters of the last instance will be used for
all instances of that button.
Since this is an FS2002 gauge you may install as many instances of a
button as you like. FS2002 regards this as a single gauge and will
maintain one copy in memory but will display multiple copies. FS2002
will not make additional copies of the gauge file in order to display
multiple instances.
Most of these buttons can be reprogrammed by entering a number in the parameter
field. All the buttons have default values which are listed below. No parameter
is needed if the default is appropriate. The result is undefined when any
parameter is not a valid number. Ordinarily, the default will be used if the
parameter is not valid for the button. Very little range checking will be made
on the parameter and no errors will be reported.
Any single button can be installed as may times on as many panels as you need.
Just remember that the parameter of the last instance of that single button
will apply to all instances of that single button.
Examples:
To use a button with the default parameter -
gauge34=RKG_buttons!Copilot_button, 479,70,12
toggles the panel with ident=ANNUNCIATOR2_PANEL (see Copilot_button below).
To use a button with a parameter -
gauge34=RKG_buttons!Copilot_button, 479,70,12,12,32
or
gauge34=RKG_buttons!Copilot_button, 479,70,12, ,32
toggles the panel with ident=32. Note that there are two consecutive commas in the
example above. The format is 'xxxx, yyyy, wwww, hhhh, parameter'.
xxxx = x position on panel
yyyy = y position on panel
wwww = gauge width
hhhh = gauge height (optional)
parameter = optional parameter
When the height is not explicitly stated a blank field is retained and indicated by
consecutive commas. A space between the consecutive commas is optional, example:
gauge34=RKG_buttons!Copilot_button, 479,70,12,,32
THE BUTTONS
The following can be reprogrammed with any panel_ident (column 2 is the default)
______________________________________________________
RKG_buttons!Annunciator_button toggles the panel with ident=ANNUNCIATOR_PANEL =125
RKG_buttons!Annunciator2_button toggles the panel with ident=ANNUNCIATOR2_PANEL =150
RKG_buttons!Collective_button toggles the panel with ident=COLLECTIVE_PANEL =200
RKG_buttons!Compass_button toggles the panel with ident=COMPASS_PANEL =75
RKG_buttons!Copilot_button toggles the panel with ident=ANNUNCIATOR2_PANEL =150
RKG_buttons!Fuel_button toggles the panel with ident=COLLECTIVE_PANEL =200
RKG_buttons!Gps_button toggles the panel with ident=GPS_PANEL =225
RKG_buttons!IFR_button toggles the panel with ident=IFR_MAIN_PANEL =175
RKG_buttons!Main_button toggles the panel with ident=MAIN_PANEL =0
RKG_buttons!Mini_Controls_button toggles the panel with ident=MINI_CONTROLS_PANEL =100
RKG_buttons!Overhead_button toggles the panel with ident=OVERHEAD_PANEL =250
RKG_buttons!Radio_button toggles the panel with ident=RADIO_STACK_PANEL =50
RKG_buttons!Throttle_button toggles the panel with ident=THROTTLE_PANEL =10
The panel ident can be any valid ident not just those listed above. For example:
This window has an ident of 35. The proper syntax for a button is:
gauge00=RKG_buttons!Overhead_button 10,10,19,,35
This places an Overhead_button on a panel and reprograms the panel_id to 35.
Pressing this button toggles the display of Window04.
Graphics for the above buttons:
_______________________________
Annunciator_button --- "a1" (text)
Annunciator2_button -- "a2" (text)
Collective_button ---- a big yellow up arrow - the collective makes a helicopter go up
Compass_button ------- pointing to North
Copilot_button ------- a navigation instrument crosshair
Fuel_button ---------- a (blue) drop of fuel
Gps_button ----------- a satellite dish
IFR_button ----------- "ifr" (text)
Main_button ---------- a yoke
Mini_Controls_button - a red right-angle marker (looks like the minicontrol window)
Overhead_button ------ a miniture overhead panel
Radio_button --------- an antenna
Throttle_button ------ a tiny tiny little jet
The following is a list of the new FS2002 panel_ident numbers. The first group is
identical to the old numbers (and idents), the second group is new to FS2002.
Note that user assigned panel_idents do not have to be greater than 10000, but it
looks like Microsoft would prefer user panel_idents to be constrained to the
range (9999 < user_ident < 20000).
These two buttons are used together, one on each of two panels, to swap the
Main panel with any other panel. Both buttons have a default parameter of 250
which is the default panel_ident for the overhead panel. Any valid panel_ident
can be used as the parameter. Both buttons should use the same panel_ident as
their parameter although some interesting results can be obtained by using
different parameters. The 'Swap_to_PanelID' button is placed on the Main panel
and when clicked closes the Main panel and opens the panel specified by its'
parameter. The 'Swap_to_Main' button is placed on the other panel (specified by
the parameter) and when clicked closes the panel specified by its' parameter and
opens the Main panel. Note that the Main panel is hardcoded and can not be changed.
The only option is to change the panel_ident of the panel that the Main panel
can be swapped with - the 'Swap_to_Main' button will always open the Main panel.
****************************************************************************
The next button set is invisible and can be programmed with any panel ident number.
There are ten buttons, 0..9, and each has a default listed below. For example,
Hidden_Panel_Ident_5_button has a default parameter of 125 and toggles the window
with ident=ANNUNCIATOR_PANEL. The parameter can be any valid panel ident.
________________________________________
RKG_buttons!Hidden_Panel_Ident_0_button
...
RKG_buttons!Hidden_Panel_Ident_9_button
This is a scrap from a panel which illustrates how to use the hidden_panel_ident
button. This panel has no controls on it - it is just a picture of a yoke.
The hidden button forms a hotspot on the bitmap - just click on it and the
window closes. Note that the panel 4 button by default refers to the
mini_controls panel and that no parameter is required.
The very same hidden button (4) could also be installed on the main panel so that
the yoke panel could be opened from the main panel by clicking on a hotspot.
Any single button can be installed as may times on as many panels as you need.
Just remember that the parameter of the last instance of that single button
will apply to all instances of that single button.
****************************************************************************
The next button set is programmed with any panel ident number. There are ten buttons,
0..9, and each has a default the same as the hidden panel button above.
For example, Panel_5_button has a default parameter of 125 and toggles
the panel with an ident=125. The parameter can be any valid panel ident.
These buttons have a text graphic of the number 0 to 9 and are not animated.
___________________________
RKG_buttons!Panel_0_button
...
RKG_buttons!Panel_9_button
The following can be reprogrammed with any key_id.
_________________________________________________
RKG_buttons!FlightMap_button key_id=896 (graphic is a route diagram)
RKG_buttons!Kneeboard_button key_id=340 (graphic is a checkmark)
RKG_buttons!Pushback_button key_id=947 (text in square)
RKG_buttons!Pushbackw_button (text in rectangle)
The above buttons are all ON/OFF toggle type buttons. The designed key_ids below
allow the button to toggle their variables and respond to the current state of
their variables. Ordinarily, OFF means a value of 0 and ON means a value of 1.
There is an OFF/ON button that starts out in the OFF state, and an ON/OFF button
that starts out in the ON state. When used with the designed key_ids below this
becomes less significant since an OFF/ON button still reads ON in the variable's
ON state. The ON/OFF and OFF/ON buttons have two sets of bitmaps. One has text
that reads 'On' in green and 'Off' in red. The other is just a green/red light.
The 'FlightMap_button' toggles the FS2002 Map window by default. It can be reprogrammed.
The 'Kneeboard_button' toggles the kneeboard by default. It can be reprogrammed.
The 'Pushback_button' is a square button and toggles the FS2002 pushback feature.
The 'Pushbackw_button' is a rectangular button and toggles the FS2002 pushback feature.
Both of these can be reprogrammed with any key_id.
The buttons 'Key_Id_0_button..Key_Id_9_button' are not animated.
They have a text graphic '0'..'9'.
The buttons 'Hidden_Key_Id_0_button..Hidden_Key_Id_9_button' are invisible. Place
these like hotspots on your panel or over built-in background bitmap graphics.
The 'Switch' buttons operate in an opposite sense.
The down switch is OFF when down.
The up switch is OFF when up.
For any of the key_id buttons the parameter may be a negative number.
When negative the button becomes 'un-hooked' from the driving variable. It still
toggles the variable but is not driven by the variable. Every click on the button
will toggle the button and toggle the state of the variable with no regard to the
previous state. This can be useful for some odd conditions. Note that if
the variable is changed by another method, such as a hot key, the button with
a negative parameter will not reflect this change.
To select a parameter for the key_id, look in the list below for the variable
of interest and use the number from column 1 or column 2 in the parameter field.
Column 2 is simply the same number as in column 1 plus 65536.
NOTE: A parameter of 0 will result in a dummy button/switch that does nothing
but alternate state when clicked. The default parameter for key_id buttons is 0.
This could be used to place dummy switches on a panel.
Included within this archive is a file 'key_id_2k2.txt' which is a complete list of all
possible key_ids. Note that variables that are not boolean (toggles) will not work
well (if at all) with any of these buttons. The buttons in this gauge set can only
send a change state message to their respective variables and they can only respond
to an ON(not 0) or OFF(0) state returned by their variables.
The following are NOT RE-PROGRAMABLE
_____________________________________
RKG_buttons!ATC_button toggles the ATC window
RKG_buttons!AP_master_switch toggles the autopilot
RKG_buttons!FD_button toggles the flight director
RKG_buttons!NavGps_button toggles NAV/GPS autopilot feature
RKG_buttons!AutoStart_button starts all engines as with CTRL-E (not animated)
RKG_buttons!AutoStop_button starts all engines and shuts down all engines
graphic = AutoStart when engines off
= AutoStop when any engine on
RKG_buttons!AutoThrottle_btn toggles the Autothrottle Arm switch (animated)
used only with Autopilots that require Autothrottle arming
****************************************************************************
The following is a list of key_ids that are implemented with driving variables
by this gauge set.
Normally, only key_ids that are toggles are used by buttons but any
key_id can be used - the result just may not be useful.
These key_ids, when set in the parameter field, cause the button to be
driven by their appropriate variable. Any key_id can be used in the
parameter field but only those below allow the switch or button to
automatically respond to the state of the respective variable. A key_id
not in this list will still function but the button will be dumb, simply
switching between on and off. A dumb button will still act on the respective
variable but if the variable is changed through another method, such as
with a hot key or with another button, the dumb button will ignore that
change. The dumb button will still work but may be reversed in the ON/OFF
sense.
The key_ids implemented below also have an appropriate help pop-up implemented
when such a help pop-up exists.
key_id - column 1 is the token number for the key_id
| column 2 is the internal number for the key_id ( = token number + 65536 )
| Either number may be used for the parameter.
|
|
|________
0 65536 KEY_ID_MIN driving variable
0 KEY_NULL ________________
998 66534 KEY_ID_MAX //LAST KEY_ID (do not use this number or any number larger)
TO INSTALL
__________
Unzip the file, RKG_buttons.gau, into your FS2002 gauges folder.
OR...
Unzip the zip file anywhere and move RKG_buttons.gau to your FS2002 gauges folder.
A NOTE
______
I have done nothing slick in the code - it does not use FSUIPC or require any
special handling. The bitmaps may be modified in any way you like.
The up/down switch bitmaps in particular are fairly rough. The standard panel ident
button graphics now are not visually similar to those supplied by Microsoft.
They can be used instead of the Microsoft buttons or in addition to them. With no
parameter they will perform the same function as the standard buttons
and with a parameter they can extend the number of functions you can implement
in a single panel window. Of course, if you have the appropriate tools you can replace
the bitmaps with anything you like such as bitmaps more visually similar
to the standard MS gauges. This should only be attempted by persons familiar
with the structure of .DLL's and gauges and with appropriate programmer tools.
There are resource editors available which can be used to manipulate the bitmaps.
Resource compilers supplied with code compiler packages (such as BRCC32 which
comes with the free Borland C++ 5.5 compiler) can also be used to replace the
bitmaps. I will not give any more instructions or advice on how to do this.
If you believe this gauge is causing your FS2002 to fail
just stop using it. This gauge cannot do damage to your FS2002 installation.
The behavior of the previous version (V1.3) of this gauge has been fixed.
When the V1.3 gauge was run under WinXP and FS2002 it would cause FS2002 to
abruptly close with no warning or error message. This was apparently a
WinXP problem possibly related to the inclusion of debugging info and
exception handling code in WinXP. This gauge now includes exception handling
code which makes it somewhat larger and unnecessarily complicated but does
not seem to slow down FS2002.
Copyright 2002 Robert K. Guy.
You may not make money with this gauge in any way whatsoever but you
may freely distribute this gauge with any panel you design that is
exclusively freeware. You are also free to upload this gauge to any
other FS site that does not charge a fee for access or for downloads.