Murga-Projects Forums

Full Version: Starved resources
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Looking for a little help...

I have an external process that I am starting that will take a while (enabling a network interface that doesn't return until DHCP returns an address) and want to alert the user that this will take a while.. so I am displaying (or trying to) a message box prior to calling this process:

displayMessage( "this will take a while...);
os.execute( "myExternalScript" );

problem is the message box doesn't pop up until after the os.execute() returns. Is there a way to wait until the message box is up before control is captured by the os.execute()? I tried a short murgaLua.sleep(50) to allow a context switch but that didn't help. Any ideas?

...
function displayMessage( msg )
do
window = fltk:Fl_Double_Window(...)
box = fltk:Fl_Box(...)
button = fltk:Fl_Button(...)
...
end
window:show()
end
check that the window is not nil before launching your network script

Code:
window = nil

function displayMessage( msg )
do
window = fltk:Fl_Double_Window(...)
box = fltk:Fl_Box(...)
button = fltk:Fl_Button(...)
...
end
window:show()
end

displayMessage("This will take a while...");

if window ~= nil then
os.execute("myExternalScript");
else
-- I dont know
end


Could also wait for the user to hit an "OK" button or some such to actually launch that external script.

Thanks for the advise, I'll try a couple of things..
Maybe try adding Fl:check() before you run the executable.

Also, Fltk has a built-in message dialog function, so unless you want something that looks a particular way you can use this

fltk.fl_message("This is my message")

You might look into fl_choice() if you want to give the user the option of cancelling the upcoming action.
Reference URL's