dlg[1][1]:action() is really a surprising way to access the button. I
understood. I can do something like:

function main(title)
local controls = {}
button1 = iup.button{title = 'Enviar'}
table.insert(controls, button1)
return iup.dialog{..., title = title, controls = controls}
end

And in another part of the code:

function dlg.controls.button1:action()

Yes, I prefer it. I really don't like action = function () return ...
I could also take advantage on the fact I have in an attribute all the
 dialog controls.

Thank you!




2012/6/5, Antonio Scuri <[email protected]>:
>> If I use button1:action, it was necessary to place it inside main whereas
>> I want
>> to place it outside.
>> How to link button1 to the button1_action(?
>
>   You can retrieve the button1 handle after calling "main". For instance:
>
> local button1 = dlg[1][1]
>
>   Or you can save the button as a custom dialog attribute inside "main" then
> retrieve it outside. For instance:
>
> return iup.dialog{vbox; title = title, button1 = button1}
>
>  Then
>
> local button1 = dlg.button1
>
>
>> button1 = iup.button{title = 'Botão 1'}
>> iup.SetAttribute(button1, 'ACTION', 'button1_action') vbox =
>> iup.vbox{button1}
>> return iup.dialog{vbox; title = title} end Actually, I want to use
>> iup.SetAttribute
>> to link events. I could place my callback without closures and without
>> action =
>> function()..
>> Why didn't iup.SetAttribute work?
>
>   Because it will assume that your callback is implemented in C and
> associated with IupSetFunction. In Lua you must use a Lua function to
> directly associate the callback.
>
> Best,
> Scuri
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to