Skip to content

Widget Rows

MorquinDevlar edited this page Aug 20, 2026 · 3 revisions

Widget Rows

For widgets that are really a stack of bars and labels (combat panels, group rosters), mdw.setWidgetRows renders a block of text and gauge rows at the top of a plain widget's content area as real Geyser elements - gauges look like gauges, names stay clickable - with the widget's console keeping whatever space remains below. MDW owns geometry and lifecycle; your package owns content, styles, and values.

mdw.setWidgetRows("Combat", {
  { id = "hdr", type = "text", text = "<136,136,136>PLAYER:", height = 14 },
  { id = "hp", type = "gauge", value = hp, max = maxhp, text = "HP " .. hp,
    front = fillCss, back = trackCss },
  { id = "foe1", type = "text", text = "<200,200,200>a goblin",
    onClick = function() send("target #1") end },
  { id = "mate1", type = "text", text = "<232,220,200>Farquin",
    rightText = "<136,136,136>L2 middle" },
})

Rows work on plain widgets only (not tabbed widgets or groups). Pass nil or {} to clear the block.

Row fields

Row Fields
Text id, type = "text", text (a decho string), optional rightText, onClick, height (default rowTextHeight, 18px), fontSize, css
Gauge id, type = "gauge", value, max, text, front, back (Qt stylesheets for fill and track), optional textStyle, fgColor, fontSize, height (default rowGaugeHeight, 16px), rightText, rightWidth

Rows are separated by rowGap (3px). A text row's css styles the row itself (default transparent), which is how a rule between blocks is drawn:

{ id = "sep", type = "text", text = "", height = 6,
  css = "background-color: rgba(0,0,0,0%); border-top: 1px solid rgb(58,53,48);" }

rightText

rightText puts a second, right-aligned text on the same strip - the web clients' space-between header line (name on the left, rank on the right). Over a text row it simply overlays: row labels use the proportional UI font, so there is no column to split at; each text runs from its own edge, and the row's onClick still belongs to the whole strip. Over a gauge row it carves out a reserved slice instead (rightWidth, default rowRightWidth = 64px, never more than half the row) - a bar cannot run under the words.

Calling it from a renderer

Call setWidgetRows on every GMCP push. Rows are diffed by their (type, id) sequence (a row gaining or losing rightText counts as a shape change) and updated in place when the sequence is unchanged, so per-combat-beat repaints never recreate Qt elements; stylesheets restyle only when the strings change.

MDW owns layout and resize (the rows track a live drag), tab-switch visibility (rows created while their widget sits behind another group tab stay hidden until that tab is selected), z-order, and teardown. Rows that would poke out of the bottom of the widget are hidden rather than painting over a neighbour.

Settings button

mdw.setWidgetMenu(name, items, title) gives a widget a vertical-ellipsis button in its top-right corner that opens a context menu - pass a function as items for live checkbox states. nil removes the button. The button dies with the widget, so declare it where you create the widget. The prompt bar has the same affordance: see Prompt Bar.

Related options: rowGaugeHeight, rowTextHeight, rowGap, rowRightWidth, menuButtonSize, menuButtonFontSize in Configuration.

Clone this wiki locally