OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

Set Tooltip Text for TButtonGadget?

Date: 11/30/99
Time: 12:18:42 AM

Q. I have SDI main window with TDecoratedFrame and some TButtonGadgets on the menu-bar. There is no tool tip (when I move over the gadget with my mouse) for those TButtonGadgets that do not have the appropriate command in the main menu. How can I set the text (tool tip text) for those TButtonGadgets (I do not want have the appropriate commands in the main menu).

A.
Include an EV_COMMAND_ENABLE in the application's response table for the TButtonGadget's id (which you supplied to the TButtonGadget's
constructor). The function called thereby gets a reference to a TCommandEnabler. You just call that TCommandEnabler's SetText member to set the hint text. For example:

...
EV_COMMAND_ENABLE(CM_BUTTONCOMMAND, SetTheButtonHint),
...

TMyApplication::SetTheButtonHint(TCommandEnabler& tce)
{
    tce.SetText("This is a hint");
    tce.Enable(true); // or false, if you have a need to disable the button
}

Jon Bloom, KE3Z
jbloom@arrl.org

Last changed: July 14, 2001