The easiest way to create buttons is using XML files. If you need it to be 'on demand' in a sense, then you can create a virtual control in an XML file, and create a button from that virtual template whenever you need it.
However, if you really want to create it from scratch in Lua, you can use WindowManager:CreateControl(string arg1, object parent, number type), with CT_BUTTON as the type. Or you can use WindowManager:CreateControlFromVirtual with some ZOS defined virtual template.
|