lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Finally got this to work :)


I've come across another issue now though. How do I use the NATIVEPARENT attribute for iup.dialog?

  Since its value is a HWND, in Lua this is an userdata.

  So some how you show push that value in Lua and use it:

Right, I've found in fact it pretty much must be a light userdata too, or it has the same issue as string (at least any use of lua_newuserdata does, as it creates a new container to hold the actual pointer in). Makes sense I suppose, as it is just a plain handle/pointer, so thats all fine.

However:

dlg = iup.dialog
{
  nativeparent = nativeparent_hwnd,
   ...
}

This doesn't work.

Nor does

 dlg.nativeparent = nativeparent_hwnd

The issue in these cases seems to be iuplua.lua's implementation of ihandle_settable(), which will not pass through light userdata (pointer) types to the underlying ihandle object.


I have, however, got it working setting it directly, using:

 iup.SetAttribute(dlg, "NATIVEPARENT", nativeparent_hwnd)

Thanks!

Love, Light and Peace,
- Peter Loveday