OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Enabling and Disabling a Gadget

You can enable and disable a gadget using the following functions:

virtual void TGadget::SetEnabled(bool);
bool TGadget::GetEnabled();

Changing the state of a gadget using the default SetEnabled function causes the gadget's bounding rectangle to be invalidated, but not erased. A derived class can override SetEnabled to modify this behavior.

If your gadget generates a command, you should implement the CommandEnable function:

virtual void CommandEnable();

The default version of CommandEnable does nothing. A derived class can override this function to provide command enabling. The gadget should send a WM_COMMAND_ENABLE message to the gadget window's parent with a command-enabler object representing the gadget.

For example, here's how the CommandEnable function might be implemented:

void TMyGadget::CommandEnable()
{
Window->Parent->HandleMessage(
0,
(LPARAM) &TMyGadgetEnabler(*Window->Parent, this));
}
#define WM_COMMAND_ENABLE
Definition dispatch.h:4103

See Also