diff options
author | deva <deva> | 2010-08-12 10:57:04 +0000 |
---|---|---|
committer | deva <deva> | 2010-08-12 10:57:04 +0000 |
commit | d9338083192084613e5530b02710b796252d342b (patch) | |
tree | e0ec2b36e0de62328e5fd5d3b597f6ee71d1b18f /server/xml/macros/test_resume.xml | |
parent | dbab8458dcce186e7eb7a114a83f759d7db5445a (diff) |
New scripting system part2.
Diffstat (limited to 'server/xml/macros/test_resume.xml')
-rw-r--r-- | server/xml/macros/test_resume.xml | 85 |
1 files changed, 69 insertions, 16 deletions
diff --git a/server/xml/macros/test_resume.xml b/server/xml/macros/test_resume.xml index c3e3cbe..05afd3f 100644 --- a/server/xml/macros/test_resume.xml +++ b/server/xml/macros/test_resume.xml @@ -1,32 +1,85 @@ <?xml version='1.0' encoding='UTF-8'?> <macro name="test_resume" version="1.0"> - <resume language="lua"> - -- This is a LUA program! - if getValue('test2') == 'ja' - then - return getValue('dims') .. ' made out of ' .. getValue('test1') .. ' and ' .. getValue('test2') - else - return 'niksen' - end + + <resume> + <script src="regexp.lua"/> + <script> + -- inline code + if(regexp('.+', '')) + then + return 'a string' + else + return 'another string' + end + </script> </resume> + <queries> </queries> + <maps> </maps> + <scripts> + <script language="lua" src="test.lua"/> + <script language="lua"> + function bar(wdg) + w = widget(wdg) + w:setValid(this:checked()) + end + + function foo() + this:setValid((string.sub(this:value(), 1, 4) == 'test')) + end + </script> </scripts> + <widgets caption="Test Resume" layout="vbox"> - <metawidget layout="vbox" name="dims" - format="${test1}: ${test2}" - storechildren="true"> - <lineedit name="test1" value="test"/> - <checkbox caption="Og svaret er?" - name="test2" value="ja" - truevalue="ja" falsevalue="nej"/> - </metawidget> + <lineedit name="test1" value="test" + onChange="this:setValid(this:value()~='')"/> + <checkbox caption="Og svaret eer?" + name="test2" value="ja" + truevalue="ja" falsevalue="nej" + onChange="bar('test1')"/> + <textedit name="test3" value="tjae" + onChange="this:setValid(this:value() == 'a')"/> + <altcombobox name="dims" value="futtefejer" layout="vbox" + onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))"> + <item caption="Test1" value="test1"/> + <item caption="Test2" value="test2"/> + <item caption="Test3" value="test3"/> + <altitem caption="Test[n]" value="test4" innerwidget="inner"> + <lineedit name="inner"/> + </altitem> + </altcombobox> + + <combobox name="combo1" type="select" + onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))"> + <item caption="Test1" value="test1"/> + <item caption="Test2" value="test2"/> + <item caption="Test3" value="test3"/> + <item caption="Test4" value="test4"/> + </combobox> + + <combobox name="combo2" type="search" + onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))"> + <item caption="Test1" value="test1"/> + <item caption="Test2" value="test2"/> + <item caption="Test3" value="test3"/> + <item caption="Test4" value="test4"/> + </combobox> + + <combobox name="combo3" type="edit" + onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))"> + <item caption="Test1" value="test1"/> + <item caption="Test2" value="test2"/> + <item caption="Test3" value="test3"/> + <item caption="Test4" value="test4"/> + </combobox> + <frame layout="hbox"> <spacer /> <button caption="Reset" action="reset"/> |