On Tue, Jun 29, 2010 at 10:14 AM, Del Mundo, Carlo Eduardo C. <carlo.eduardo.c.del.mu...@saic.com> wrote: > Hi all!
Hi, sorry about the very long delay... > After searching through the archives, I have found a few situations similar > to my problem but few solutions. Basically, I am writing a GUI application > that edits a configuration.lua file that contains the following entries: > > ID # > > Color > Roughness > LightEmission > Conductivity > myAddFunction(id, color, rough, light, cond); > > ..... etc > > Note that after each entry, the myAddFunction() adds the entry to a table of > values. This table is then queried by a Lua-C++ interpreter. You have a lot of options, but if I understand correctly the GUI will be in C++. I would create a wxLuaState in C++ and call wxLuaState::LuaDoFile(...) on your config files. You could use wxLuaState::RegisterFunction(...) to add your C/C++ "myAddFunction" as a function for Lua that will add the items appropriately. > Now, I have attached an image that is a screenshot from lua.org that depicts > a similar project (to give you perspective). My end goal is to have a GUI > that: > > 1.) Reads the entries in the configuration.lua file (as shown above) > 2.) Edit Attributes per entry > 3.) Add a New Entry > > The question is, how can I achieve the three goals? Originally, I was going > to use Java Swing and parse the configuration.lua file LINE BY LINE but > realized this is unsophisticated and would break with a badly written input > file. The control shown in the image is a wxListCtrl and there's some sample code for it below. This code may be a little complicated since it has to sync a wxTreeCtrl with the wxListCtrl. http://wxlua.cvs.sourceforge.net/viewvc/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp?view=markup You could even turn it around and write all the adding code in Lua itself and all you need to do is push your wxListCtrl into Lua using code like this, search for "wxLua_wxListCtrl_constructor1" and see the bottom where it calls wxluaW_addtrackedwindow() and wxluaT_pushuserdatatype() so that it's on the stack. http://wxlua.cvs.sourceforge.net/viewvc/wxlua/wxLua/modules/wxbind/src/wxcore_controls.cpp?view=markup I hope this gives you some ideas, John Labenski ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users