How can I derive a new GUI element in IUP from an existing element like frame, button or label. I am working in Lua language on Debian Linux. I tried following but they do not work:
MyButton = iup.button{title="", size="40x40"}:new()
The error is:
attempt to call method 'new' (a nil value)
IupButton:new()
also does not work.
I tried checking different sites like http://webserver2.tecgraf.puc-rio.br/iup/ , https://webserver2.tecgraf.puc-rio.br/iup/en/iuplua_adv.html and https://metacpan.org/pod/distribution/IUP/lib/IUP.pod but could not find the method.
How do I create derived classes in IUP and Lua?
You don't derive, you simply instantiate using:
MyButton = iup.button{title="", size="40x40"}
Without the ":new()" part.
To create a custom behavior button that will be reused in several places, the steps are more complex that this. IUP is not friendly for that. I actually don't remember having such an example. But you can always to that using a simple function that creates a button with the attributes and callbacks you want.