News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Starved resources
Author Message
ceeuu
Junior Member
**


Posts: 9
Group: Registered
Joined: Jul 2008
Status: Offline
Reputation: 0
Post: #1
Starved resources

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

03-24-2013 05:37 AM
Find all posts by this user Quote this message in a reply
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #2
RE: Starved resources

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.

03-24-2013 04:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ceeuu
Junior Member
**


Posts: 9
Group: Registered
Joined: Jul 2008
Status: Offline
Reputation: 0
Post: #3
RE: Starved resources

Thanks for the advise, I'll try a couple of things..

03-25-2013 12:48 AM
Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #4
RE: Starved resources

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.

This post was last modified: 05-24-2013 05:45 AM by mikshaw.

05-24-2013 04:41 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: