The 4th parameter is needed so I can distinguish from the situation where
iup.IGNORE is returned. Since they all are numbers there is no way to
distinguish from the rgb values.
The documentation specifies a return value:
int function(Ihandle **ih*, int *lin*, int *col*, int **red*, int
**green*, int **blue*); [in C]*ih*:bgcolor_cb(*lin, col*: number) ->
(*red, green, blue, ret*: number) [in Lua]
The automatic assignment for iup.DEFAULT on return values can be used
only no return value is used, which is equivalent to returning "nil".
Best,
Scuri
On Mon, Jun 20, 2016 at 9:38 PM, John Huttley <[email protected]>
wrote:
> Thank you Antonio,
>
>
> That works perfectly. However I'm at a loss to understand
>
> why iup.DEFAULT is needed, since I'm providing the three params. Why is
> any default needed in this case? from the doc " the IupLua binding will
> automatically return IUP_DEFAULT if no value is returned."
>
>
> why its the 4th param. Reviewing the documentation I still only see the
> RGB.
>
>
> in the doc I see only this section, which explicitly applies to C
>
> ========
>
> The callbacks implemented in C by the application must return one of the
> following values:
>
> - IUP_DEFAULT: Proceeds normally with user interaction. In case other
> return values do not apply, the callback should return this value.
> - IUP_CLOSE: Call *IupExitLoop* after return. Depending on the state
> of the application it will close all windows and exit the application.
> Applies only to some actions.
> - IUP_IGNORE: Makes the native system ignore that callback action.
> Applies only to some actions.
> - IUP_CONTINUE: Makes the element to ignore the callback and pass the
> treatment of the execution to the parent element. Applies only to some
> actions.
>
> ======
>
> Which explains the iup.IGNORE (thanks), but the significance of the others
> is clearly understated!
>
> I think you might want to revisit that section.
>
> Regards,
>
> John
>
>
>
>
> On 20/06/2016 10:04 AM, Antonio Scuri wrote:
>
> Try this:
>
> function matrix:bgcolor_cb(l, c)
> -- play here
> local green =0
> local blue =0
> local red =200
> if c == 0 then
> return iup.IGNORE -- title row, not used
> end
>
> if l == 0 then -- title column
> return iup.IGNORE
> end
>
> return red, green, blue, iup.DEFAULT
> end
>
> Best,
> Scuri
>
>
>
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users