File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,21 @@ beyond your everyday `widgets.Widget <widget>`:
7272 screen, but the returned screen can instantiate and configure any new views
7373 that it wants to. See the `hotkeys ` DFHack logo widget for an example.
7474
75+ The ``overlay_trigger() `` function enables the activation of overlay widgets
76+ via the command line interface (CLI) or keybindings.
77+ For example, executing ``overlay trigger notes.map_notes add Kitchen ``::
78+
79+ function MyOverlayWidget:overlay_trigger(arg1, arg2)
80+ if arg1 == 'add' then
81+ -- Add a new note to the map
82+ self:addSomething(arg2)
83+ elseif arg1 == 'delete' then
84+ self:deleteSomething(arg2)
85+ end
86+ end
87+
88+ This allows for dynamic updates to UI overlays directly from the CLI.
89+
7590If the widget can take up a variable amount of space on the screen, and you want
7691the widget to adjust its position according to the size of its contents, you can
7792modify ``self.frame.w `` and ``self.frame.h `` at any time -- in ``init() `` or in
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ Examples
4949``overlay trigger hotkeys.menu ``
5050 Trigger the `hotkeys ` menu widget so that it shows its popup menu. This is
5151 what is run when you hit :kbd: `Ctrl `:kbd: `Shift `:kbd: `C `.
52+ ``overlay trigger notes.map_notes add Kitchen ``
53+ Trigger the `notes ` overlay widget so that it shows its new note popup
54+ with given title.
5255
5356Widget position
5457---------------
Original file line number Diff line number Diff line change @@ -383,7 +383,11 @@ local function do_trigger(args, quiet)
383383 do_by_names_or_numbers (args [1 ], function (name , db_entry )
384384 local widget = db_entry .widget
385385 if widget .overlay_trigger then
386- register_trigger_lock_screen (widget :overlay_trigger (), name )
386+ register_trigger_lock_screen (
387+ widget :overlay_trigger (table.unpack (args , 2 )),
388+ name
389+ )
390+
387391 if not quiet then
388392 print ((' triggered widget %s' ):format (name ))
389393 end
You can’t perform that action at this time.
0 commit comments