Combobox.font read/write property


Get the Combobox font, a string value that represent the font name.
To set the Combobox.font property, you can assign a string that represent either a font name of an installed system font, or a font file (*.ttf, *.fon...). A File can also be provided, representing a font file.
Note that only the font family is changed. The font style and font size are not affected (see the Combobox.fontstyle and the Combobox.fontsize properties).

  • By default, an Combobox uses the same font as its parent widget
  • Any change in the Combobox.font, Combobox.fontstyle and Combobox.fontsize properties results in an automatic resizing of the Combobox so that the content is displayed correctly

Example

local ui = require "ui" -- create a simple window local win = ui.Window("Combobox.font sample", 320, 200) local combobox = ui.Combobox(win, {'Item 1', 'Item 2'}, 20,70) combobox.fontsize = 12 combobox.width = 260 combobox.text = "Hello World in '"..combobox.font.."' "..combobox.fontsize.."px" win:show() -- update the user interface until the user closes the Window repeat ui.update() until not win.visible