|
Post by bushrat on Sept 16, 2019 22:47:02 GMT -5
been a Liberty Basic user for many years, had a lot of fun with it.
so, I've written a stack of independent programs on subject X they all run perfectly. Problem: I don't want to merge them all into one giant program (about 15,000 lines) neither do I want to run each program independently.
What I have done is written a master menu program which calls the independent programs as I select a topic of my choice via a radiobutton in the master menu program.
This I've done by making all the sub programs 'TKN' files and everything once again works perfectly - except for returning back cleanly to the master menu program.
Once a chosen TKN file has executed I get a message that "program XXX has executed..." which I don't want to see (and in settings there is a box to check for this to be hidden or not but it doesn't work) and in addition I get a blank screen page which I also don't want to see. I can leave the page by exiting manually (top RH corner 'X') but I shouldn't have to do this surely?
More generally when I'm running any program and it's finished executing I never get back to the source code page where the 'Run' command started it. Is this normal?
I hope that all makes sense and someone has the patience to reply - if you do, then thanks in advance.
|
|
|
Post by tsh73 on Sept 16, 2019 23:30:50 GMT -5
Does your child program that leaves screen a console program (mainwin) or GUI? If it's console program, does it ends with END or just runs to last line? Do you call program with RUN child.tkn or RUN runtime.exe child.tkn ?
in my test, console child run throught runtime ending with END closes cleanly. Also, RUN child.tkn waits for child to finish, while RUN runtime.exe child.tkn returns immediately to caller program (so caller and child execute in parallel).
|
|
|
Post by bushrat on Sept 16, 2019 23:41:55 GMT -5
wow! quick response thanks.
yeah, I should have been a bit more specific.
the child program is 'mainwin' - should I be closing 'mainwin' in the child program?
Child program is called with 'run child.tkn'
The child program simply finishes with 'end'
I've never run any program with '.exe' extension? - only ever run with '.bas' extension?
Maybe I've been mistaken about running Liberty programs since ever?
If you have further advice I'd be grateful.
thanks for your help.
|
|
|
Post by tsh73 on Sept 17, 2019 2:38:01 GMT -5
|
|
|
Post by Rod on Sept 17, 2019 3:45:23 GMT -5
We are back to the nomainwin problem. It is a debugging and testing resource, it has limitations. One of which is that it is always on.
Try this master.bas
nomainwin WindowWidth = 400 WindowHeight = 400 UpperLeftX = int((DisplayWidth-WindowWidth)/2) UpperLeftY = int((DisplayHeight-WindowHeight)/2) button #1.ae, "Program 1", [p1], UL, 100, 100, 200,20 button #1.ae, "Program 2", [p2], UL, 100, 130,200, 20 open "Program Manager" for window as #1 print #1, "trapclose [quit]" wait
[p1] run "p1.tkn" wait
[p2] run "p2.tkn" wait
[quit] close #1 end
Now create two .tkn files called p1.tkn and p2.tkn from this child.bas
'set the window size nomainwin WindowWidth = 400 WindowHeight = 300 statictext #demo, "Counter", 10, 10, 40, 18 textbox #demo.counter, 90, 10, 180, 25 button #demo.bexit, "Exit", [quit], UL, 200, 100 button #demo.bstart, "Restart", [restartClicked], UL, 100, 100
'open the window open "Child" for window as #demo 'tell the window where to go when it closes print #demo, "trapclose [quit]"
'start timer calls timer 100,[count] wait
[count] counter=counter+1 print #demo.counter, counter wait
[restartClicked] timer 0 counter=0 timer 100,[count] wait
[quit] close #demo end
Now in this code set I close the debugging and testing window and gain complete control over the GUI windows that my program launches.
|
|
|
Post by bushrat on Sept 17, 2019 22:59:57 GMT -5
Thank you tsh73 and Rod for your helpful replies.
Unfortunately I just got swamped with work but as soon as I have some free time I'll try all suggestions and I'll let you know the results.
thanks again.
|
|