Edit.fontstyle read/write property


Get or set the Edit font style, a table value that contains the following keys/values :

  • "italic" : set to true if the font is in italic.
  • "underline" : set to true if the font is underlined.
  • "strike" : set to true if the font is striked.
  • "thin" : set to true if the font is thin.
  • "bold" : set to true if the font is bold.
  • "heavy" : set to true if the font is heavy.

Example

local ui = require "ui" -- create a simple window local win = ui.Window("Edit.fontstyle sample", "fixed", 340, 250) local label = ui.Label(win, "Enter text : ", 10, 40) local edit = ui.Edit(win, "", label.x + label.width + 8, label.y) -- create a combobox local cb = ui.Combobox(win, { "bold", "italic", "underline", "heavy", "thin" }, 150, 10) cb.selected = cb.items[5] -- change edit.fontstyle upon selection function cb:onSelect(item) edit.fontstyle = { [item.text] = true } end -- set Edit properties edit.font = "Times New Roman" edit.fontsize = 10 edit.text = [[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]] edit.wordwrap = true win:show() -- update the user interface until the user closes the Window repeat ui.update() until not win.visible