(05-09-2016, 09:46 PM)bbjimmy Wrote: yes, launch a separate program and have it send a message when the process is done. Then the main loop can spin the spinner until it receives the done message.
OK, here's one approach:
Code:
#!/bin/env yab
DEBUG = 0
displaymessage$ = "Please Wait ..."
import spinner
OpenWindow()
//Main Message Loop
dim msg$(1)
while(not leavingLoop)
nCommands = token(message$, msg$(), "|")
for everyCommand = 1 to nCommands
if(DEBUG and msg$(everyCommand)<>"") print msg$(everyCommand)
switch(msg$(everyCommand))
case "_QuitRequested":
leavingLoop = true
break
default:
break
end switch
next everyCommand
spin("Barber")
wend
CloseWindow()
end
sub CloseWindow()
window close "MainWindow"
end sub
sub OpenWindow()
window open 100,100 to 600,150, "MainWindow", "barberpole"
window set "MainWindow", "look", "bordered"
view 1,3 to 500,28, "SpinView", "MainWindow"
new_spinner(1,1,25,497, "Barber", "SpinView")
display_spinner("Barber")
view 3,31 to 497,50, "MsgView", "MainWindow"
text 1,4 to 494, 19,"themessage", displaymessage$, "MsgView"
text set "themessage", "align-center"
end sub
compile that as the executable "barberpole" (actually, I call dibs on that name - name yours something related to your app like "barberpole_MyGreatApp")
Now call it in yab with
system("barberpole")
When you no longer need it, there are two ways to get rid of it. The elegant way:
system("hey barberpole quit")
The brute force way:
system("kill barberpole")
Of course if there were two barberpoles active they would both be killed, which is why you should name your version appropriately.
This is just a quick mockup. A proper CLI app would put itself in the screen centre, have parameters to change colours and direction, a custom message and so on. I think I will develop that further.