lua-users home
lua-l archive

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


  Hi,

  If you want to keep your script running while interacting with a dialog,
then you must call iup.MainLoop. You can do it inside the script you open,
or you can do it after calling dofile.

Best,
scuri

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Merick
> Sent: domingo, 16 de setembro de 2007 12:27
> To: lua@bazar2.conectiva.com.br
> Subject: lua + iup help
> 
> 
> I'm using FreeBasic to make a lua script interpreter, and 
> dynamically linking to iup with iuplua51.dll and 
> iuplua51controls.dll. The way I have it now, when you start 
> the interpreter it automatically loads a script called "main.lua"
> 
> The default main.lua that I will be packaging with the 
> interpreter uses iup.filedlg to let the user select a lua 
> script, which will the be run with dofile. This by itself 
> works fine, however if I try to run any of the demo lua 
> scripts from the iup package, although they do run and 
> display the demo dialogs, the scripts immediately exit back 
> to the main.lua script which pops up the open file dialog 
> again. At this point, although the dialog created by the demo 
> script is still on screen, it can't be interacted with at 
> all. I tried adding a couple different types of loops to 
> pause the script, but although adding them to the demo 
> scripts kept them from returning back to main, I'm still 
> unable to interact with the dialog created by the demo.
> 
> Can anyone tell me how to run a loop and still be able to use 
> the created dialog?
> 
> Here's the script I'm using for main.lua:
> 
> main_loop = true
> 
> main_open_dlg = iup.filedlg{dialogtype = "OPEN", title = "Run 
> Lua Script", 
>                       filter = "*.lua", filterinfo = "Lua Scripts",
>                       directory=exepath().."\\scripts", 
> nochangedir = "NO"}
> 						  
> 
> while main_loop do
> 	main_open_dlg:popup (iup.CENTER, iup.CENTER)
> 
> 
> 	if main_open_dlg.status == "0" then
> 		if main_open_dlg.fileexist == "YES" then
> 			dofile(main_open_dlg.value)
> 		else
> 			iup.Message("File does not exist!", 
> main_open_dlg.value)
> 		end
> 	elseif main_open_dlg.status == "-1" then
> 		local main_quit = iup.Alarm("FB Lua", "No 
> script selected, exit interpreter?" ,"Yes" ,"No")
> 		if main_quit == 1 then 
> 			main_loop = false
> 		end
> 	end
> 	
> end
> --
> View this message in context: 
> http://www.nabble.com/lua-%2B-iup-help-tf4455569.html#a12706641
> Sent from the Lua - General mailing list archive at Nabble.com.
>