lua-users home
lua-l archive

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


CHU Run-min wrote:
My idea is that Lua script like a hook to the native GUI system.
There is a general hook function in Lua, OnWindowMessage(hwnd, msg_name,...)
There is also a general window procedure in C. It translates some
necessary window messages to Lua by calling OnWindowMessage.
We will subclass all created window to the general window procedure
and save old window procedure in window's user data field.
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)SubclassWindow(hwnd,
SubclassProc));

The window message will be forward to old window procedure unless
OnWindowMessage returns true.

Now, we call do something with OnWindowMessage.

Why not just use wxLua? It is a really nice interface to wxWidgets from Lua. It has all the characteristics you want. It uses the native widget library and can be scripted from Lua. The only disadvantage is that it is a bit big, around 3MB if you link with every possible widget. But that's not much of an issue for most environments from what I have seen. And it has the added benefit of being cross platform. A wxLua app written for Win32 will behave the same on Linux, using the native GTK widgets or Motif, and on Mac OS 9 or 10! It even works on some embedded systems, including Palm OS. Hard to beat all that...

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'