SetGadgetHelp gadget,topic$[,item]

Parameters

gadget - gadget handle, such as a button, text field or toolbar

topic$ - the help topic to report, such as a page name or anchor; "" removes the gadget's topic

item (optional) - for a toolbar, the button's index, counting from 0; -1 for any other gadget (default)

Description

Gives a gadget a help topic that F1 reports while the mouse pointer is over it.

Context help lets the people using your tool point at a control, press F1, and find out what it does. Give each control a topic - a page name, an anchor, any text your program understands. When F1 is pressed over that control, a gadget help event ($407) arrives: EventSource() is the gadget, EventText() is the topic, EventData() is the toolbar button's index (or -1), and EventZ() is the window that contains the gadget. Your event loop decides what to show, typically a page in an HTML panel opened with SetPanelHtml:

SetGadgetHelp save_button,"saving"
SetGadgetHelp toolbar,"new-level",0
If WaitEvent()=$407 Then SetPanelHtml help_panel,"help.html",EventText()

For a toolbar, give each button its own topic by passing its index as item. Every other kind of gadget uses the default item of -1.

The pointer decides, not the keyboard focus: F1 reports the gadget under the mouse, even a disabled one or an open drop-down list. The topic belongs to the gadget, so it moves with the gadget to a new parent and is removed when the gadget is freed. The World Editor gives every control a topic this way.


See also: SetPanelHtml, SetGadgetToolTip, WaitEvent, EventText, EventData.

Index