Hi Milind,

 

 The main loop closes because there is no more open dialogs. To avoid doing 
that set LOCKLOOP=Yes.

 

  Read the documentation of the IupMainLoop function and you you find this 
information there along with how to end it programmatically.

 

Best,

Scuri

 

From: Milind Gupta [mailto:[email protected]] 
Sent: sábado, 7 de junho de 2014 02:10
To: IUP discussion list.
Subject: Re: [Iup-users] iup.mainloop

 

I got half of the functionality working by modifying the above code as:

 

iup = require("iuplua")

 

local timer = iup.timer{time = 50, run = "YES"}

 

local flag

function timer:action_cb()

          print("Timer run")

          timer.run = "NO"

          if not flag then

                      local iupx = require "iupx" 

 

                      plot = iupx.pplot {TITLE = "Simple Data", 
AXS_BOUNDS={0,0,100,100}}

                      plot:AddSeries ({{0,0},{10,10},{20,30},{30,45}})

                      plot:AddSeries ({{40,40},{50,55},{60,60},{70,65}})

                      local dlg = iup.dialog({plot; title="Easy 
Plotting",size="QUARTERxQUARTER"})

                      dlg:show()

          end

          flag = true

          timer.run = "YES"

end

 

 

iup.MainLoop()

 

 

 

But the program ends as soon as the dialog closes. How can I keep iup running? 
The timer is still running so why does iup exit?

 

Thanks,

Milind

 

 

 

On Fri, Jun 6, 2014 at 10:03 PM, Milind Gupta <[email protected]> wrote:

Hi,

     I have created a timer and then I do iup.mainloop. In the timer I create a 
dialog the 1st time. But somehow the dialog seems to be flickering:

 

iup = require("iuplua")

 

local timer = iup.timer{time = 50, run = "YES"}

local flag

function timer:action_cb()

print("Timer run")

if not flag then

local iupx = require "iupx" 

 

plot = iupx.pplot {TITLE = "Simple Data", AXS_BOUNDS={0,0,100,100}}

plot:AddSeries ({{0,0},{10,10},{20,30},{30,45}})

plot:AddSeries ({{40,40},{50,55},{60,60},{70,65}})

iupx.show_dialog{plot; title="Easy Plotting",size="QUARTERxQUARTER"}

end

flag = true

end

 

iup.MainLoop()

 

What I want to achieve is that the dialog be created with the timer function 
running in the background which may create additional dialogs. When the user 
closes the dialog it does not affect the timer function and it may keep 
creating more dialogs. 

 

Also now once I have the above functionality what would be the procedure to end 
the program?

 

Thanks,

Milind

 

 

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to