A modal dialog (fl_selector) that asks the player to pick one choice from a combo box. It shows itself in the center of the screen as soon as it is created. Set its texts with set_title, set_text and set_value, and add the choices with add_choice; picking a choice runs its callback and removes the dialog. Derives from DFrame.

Summary

Methods

Adds a choice to the combo box.
Init()client
Builds and shows the modal dialog: a message label and a combo box.
Sets the message shown above the combo box and resizes the dialog to fit it.
Sets the title of the dialog window.
Sets the text shown in the combo box before anything is selected.
Resizes the dialog to fit the message and the combo box.

Methods

PANEL:add_choice(text, callback)

client packages/active_ui/views/base/cl_selector.lua:83

Adds a choice to the combo box. Selecting it runs the callback and removes the selector.

local selector = vgui.Create('fl_selector')
selector:set_title(t'ui.admin.selector.title')
selector:set_text(t'ui.admin.selector.message')
selector:set_value(t'ui.admin.selector.roles')

for _, role in pairs(Bolt:get_roles()) do
  selector:add_choice(role.name, function()
    Cable.send('fl_bolt_set_role', self.player, role.role_id)
  end)
end

Parameters

  • text String label of the choice
  • callback Function optional, defaults to nil called without arguments when the choice is selected

Builds and shows the modal dialog: a message label and a combo box. Selecting a choice runs its callback and removes the selector.

Sets the message shown above the combo box and resizes the dialog to fit it.

Parameters

  • text String

Sets the title of the dialog window.

Parameters

  • text String

PANEL:set_value(value)

client packages/active_ui/views/base/cl_selector.lua:64

Sets the text shown in the combo box before anything is selected.

Parameters

  • value String

PANEL:SizeToContents()

client packages/active_ui/views/base/cl_selector.lua:41

Resizes the dialog to fit the message and the combo box.

Defined in