RUN program control
Feb 10, 2010 10:48:13 GMT -5
Post by kokenge on Feb 10, 2010 10:48:13 GMT -5
I have a two programs.
1. RUNNING program uses the render to run a program
2. RUNNED is the program being run.
The first program runs the second. The second program has the option of doing something, or exiting back to the first. In my case the second program can update some records, or not. When the first program is returned control, it should display stuff the second program did.
PROBLEM: The second (RUNNED) program can Exit ok. However it Does Something, it should fire and event to return to the first.
It always returns to the Run Basic Login screen.
What am I doing wrong???
Using Firefox and XP. In using the layout_project in RB.
The Running Program
The RUNNED (child) program
Thanks for the help...
Have a great day..
Dan
1. RUNNING program uses the render to run a program
2. RUNNED is the program being run.
The first program runs the second. The second program has the option of doing something, or exiting back to the first. In my case the second program can update some records, or not. When the first program is returned control, it should display stuff the second program did.
PROBLEM: The second (RUNNED) program can Exit ok. However it Does Something, it should fire and event to return to the first.
It always returns to the Run Basic Login screen.
What am I doing wrong???
Using Firefox and XP. In using the layout_project in RB.
The Running Program
' -----------------------------------------
' test.bas
' RUNNING program
' -----------------------------------------
' CSSClass ".hide", "{visibility: hidden; height:0px; bprder:none}"
projectDir$ = "layout_project"
incdir$ = DefaultDir$ + "\projects\" + projectDir$ + "\"
' ----------- Main code --------------------
[main]
cls
html "Hello I'm at main<P>"
button #run, "Run",[doRun]
html "<hr>"
wait
' -----------------------------
' Run a program
' -----------------------------
[doRun]
button #c, "Main", [main]
#c setkey(rowid$)
#c setid("clickThis")
#c cssclass("hide")
exitBack$ = "clickThis"
gosub [runProg]
wait
' -------------------------------------------
' gosub to Run the program
' UserInfo$ tells the RUNNED program what
' the ID of the RUNNING button you wanna push
' -------------------------------------------
[runProg]
UserInfo$ = "clickThis"
run incdir$;"aRun.bas",#include
render #include
RETURN
The RUNNED (child) program
' ------------------------------------------
' aRun.bas
' RUNNED program
' ------------------------------------------
runExit$ = UserInfo$
' -----------------------------------------
' JS to fire event
' -----------------------------------------
html "<script type='text/javascript'>
function fireEvent(obj,evt)
{
var fireOnThis = obj;
if( document.createEvent ) {
var evObj = document.createEvent('MouseEvents');
evObj.initEvent( evt, true, false );
fireOnThis.dispatchEvent(evObj);
} else if( document.createEventObject ) {
fireOnThis.fireEvent('on'+evt);
}
}
</script>
"
html "
Hello I'm in the run program
The exit in main is at ";runExit$
html "<P>"
button #acd, "Do Something", [doClick]
#acd setid("xx")
' -------------------------------------------
' Button to return to RUNNING program
' -------------------------------------------
button #exit, "Exit",[doExit]
#exit setid("exitMe")
html "<script>
document.getElementById('exitMe').name = document.getElementById('";runExit$;"').name;
</script>"
wait
' ----------------------------------------
' Button to do something and then
' return to the RUNNING program
' ----------------------------------------
[doClick]
html "<P>Do Something <P>"
html "<script>
fireEvent(document.getElementById('";runExit$;"'),'click');
</script>"
wait
[doExit]
wait
Thanks for the help...
Have a great day..
Dan