Tip on dynamic tool tips (in C)

I've been trying to fathom out the "authorised" way of doing dynamic tooltips for C gauges and they way it's described in the SDK and in Dai's book is a lot more complicated that it need be.

Instead of going through all the MOUSE_TOOLTIP_ARG shenanigans, you can instead do this:

1. Define a string to hold the tooltip. (Make sure it's big enough.) Such as:

char aft_pump_tooltip[40] = "";

2. Where your mouse area is defined, specify the tooltip as a pointer to a char array, i.e.


3. In your main gauge callback, icon callback or whatever code is getting called each drawing cycle, write to the tooltip, i.e:

FLOAT64 FSAPI aft_pump_icon_cb( PELEMENT_ICON pelement )
strcpy(aft_pump_tooltip,"Aft Fuel Pump");

switch ((SINT32)ex_AFuelPumpOn2_bool)
case 0:
strcat(aft_pump_tooltip," (Off)");
return 0;

strcat(aft_pump_tooltip," (On)");
return 1;

In this case the callback is the MAKE_ICON callback, and the graphic and tooltip are being set according to one of my own internal variables, rather than a sim module var.

I can't see any disadvantage to doing it this way as opposed to the convoluted way the SDK and Dai's book describe. It wouldn't work if the gauge copied the contents of the string originally passed to the MOUSE_TOOLTIP_STRING macro for use somewhere else (as it does pelement structures), but it doesn't appear to.