helloworld.lua

00001 local function activate()
00002                 --create a new window called "mainwindow" at (50,20) with size 600*400
00003                 local window=ParaUI.CreateUIObject("container","mainwindow","_lt",50,20,600,400);
00004                 --attach the control to root
00005                 window:AttachToRoot();
00006 
00007                 --create a new button called "btnok" at (50,500) with size 70*30
00008                 local button=ParaUI.CreateUIObject("button","btnok","_lt",50,350,70,30);
00009                 --attach the button to the window
00010                 window:AddChild(button);
00011                 button.text="OK";
00012                 --if the button is clicked, close the window
00013                 button.onclick="(gl)script/empty.lua;ParaUI.Destroy(\"mainwindow\");";
00014                 --create a new text box called "txt" at (50,50) with size 500*300
00015                 local text=ParaUI.CreateUIObject("text","txt","_lt",50,50,500,300);
00016                 --attach the text to the window
00017                 window:AddChild(text);
00018                 text.text="Hello world!!!";     
00019 end
00020 
00021 
00022 NPL.this(activate);
00023 

Generated on Mon Dec 1 14:34:40 2008 for NPL Scripting Reference for ParaEngine by  doxygen 1.5.2