• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Tip on dynamic tool tips (in C)

Messages
516
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.

MOUSE_TOOLTIP_STRING(aft_pump_tooltip)

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;

default:
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.

Si
 
Back
Top