May 4, 200620 yr Hello,I would appreciate some help to get my dynamic mouse tooltip give me the frequency with the decimals for my radio COM1.Actually, I have a static variable and a callback calculating and returning the right frequency value.Arg_Get_Frequency, returns it. So I have declared the arguments array as followsstatic MOUSE_TOOLTIP_ARGS(com_freq_arg) MOUSE_TOOLTIP_ARG(MODULE_VAR_NONE, 0, NULL, NULL, NULL, Arg_Get_Frequency, NULL, NULL) MOUSE_TOOLTIP_ARGS_ENDand made the mouse tooltip like hereafter :static MOUSE_BEGIN( mouse_rect, HELP_NONE, 0, 0 ) MOUSE_TOOLTIP_TEXT_STRING("Communications Radio COM1 - %1!d.! MHz",com_freq_arg) ...... MOUSE_ENDIn that case I get the integer value of the frequency in the help.How can I get the frequency with the decimals ?I tried :MOUSE_TOOLTIP_TEXT_STRING("Communications Radio COM1 - %!07.3f! MHz",com_freq_arg)but it does not work;Any help would be greatly appreciatedThanksJean-Pierre
May 4, 200620 yr Author Moderator How have you declared com_freq_arg? Is it an int or float? If it is an integer (int) type, then try casting the variable with (float):MOUSE_TOOLTIP_TEXT_STRING("Communications Radio COM1 - %!07.3f! MHz",(float)com_freq_arg) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
May 5, 200620 yr Change this:MOUSE_TOOLTIP_TEXT_STRING("Communications Radio COM1 - %!07.3f! MHz",com_freq_arg)to this:MOUSE_TOOLTIP_TEXT_STRING("Communications Radio COM1 - %1!07.3f! MHz",com_freq_arg)You lost the '1' after the '%' symbol.Doug
May 5, 200620 yr Hello,Thanks to all of you, the right answer wasMOUSE_TOOLTIP_TEXT_STRING("Communications Radio COM1 - %1!07.3f! MHz",com_freq_arg)Adding a 1 fefore the format telles which arguments array entry is selected. Without it, the entry would be 0. I had forgotten that.Here is the result on my "new" old type radioThanks once moreJean-Pierre
May 5, 200620 yr Author Moderator Hmmm... I'm happy that Doug had the right answer, 'cause I was sure way off base... ;)The gauge looks nice, although I had to 'save it' to a temp file and rename it to xxx.jpg in order to see it... Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
Create an account or sign in to comment