Blitz3D+ Command Reference

ActivateGadget gadget

Parameters

gadget - handle of the gadget to give keyboard focus to

Description

Gives a gadget keyboard focus.

Requires Extended language mode.

Moves the keyboard focus to a gadget, exactly as if the user had clicked it or tabbed onto it. Whatever the user types next goes to that gadget, and its key events start arriving through the shared event queue.

The classic use is polish for tool windows: after you open a rename dialog or a search panel, call ActivateGadget on its text field so the user can start typing straight away. It is also handy for bouncing focus back to a field that failed validation.

The gadget that receives focus posts a gadget-activate event ($402) with EventSource set to its handle - the same event the user's own clicks produce.

When several 3D canvases share the renderer, activating a canvas also makes it the one that feeds the direct KeyDown/MouseDown polling commands.

The world editor shell sample shows the kind of multi-gadget layout where focus control matters.

See also: ActivateWindow, EnableGadget, ShowGadget, CreateTextField, EventID.

Index