Lua Radio buttonsForum: Programming and Scripting Topic: Lua Radio buttons started by: u2musicmike Posted by u2musicmike on Jan. 24 2007,20:34
I am trying to get radio buttons to work in a short lua program:
No matter what I click the value is never set unless I do it manually. I tried to do it like the fdtool program but I am missing something. Can somebody point me to a site that has some lua radio button code? Posted by roberts on Jan. 24 2007,21:11
What is your enclosing container, group or window?What gui is going to have the callback attached so you can display the results of the radio button selection. We have 5 lua programs that use radio buttons, from simple to more complex for you to study. icontool mouse-config rdesktop wallpaper fdtool Posted by mikshaw on Jan. 24 2007,22:22
Something like this might help?
If you have multiple sets of radio buttons you'll probably need to create a unique group for each set of buttons. Also, this example uses the label of each button to determine the value of foodcat Posted by u2musicmike on Jan. 26 2007,15:41
Thanks for the help. I was really stuck. The radio buttons work now. That is a pretty neat trick to pull the labels from the buttons. I don't know the lua programming language very well but I am trying to build a data entry form for a sqlite database. As a starting point I took the window routines from the fdtool.lua program and changed a few things like button names and input fields. If I can get it to produce the sql statement that I want I will post the code or make a dsl package.One thing that I found strange was the function has to be before the radio button statements. Posted by mikshaw on Jan. 26 2007,18:12
Apparently some languages don't require the function to be defined first, but Lua seems to be one that does. I assume this is because Lua is interpreted line-by-line at runtime, so it needs to know what a callback does before it can use the callback. Maybe the function could first be declared without being fully defined, like in C, but I haven't really had any need or desire to experiment with that yet.I know nothing about using sql databases yet, so I can't help there. So far my experience with saving and retreiving data has been in parsing plain text rc files, like many of the DSL tools do. |