Opening RB in new window

new BookmarkLockedFalling
Psycho
Full Member
***

Psycho Avatar

Posts: 196

Post by Psycho on Jan 2, 2009 22:06:51 GMT -5

Is there a way to open a new window and display your RB code in the new window?

I know the html code for opening a new window when using an external link but I am generating an invoice within some parent/child programs and want the links from the programs to remain on screen. At the same time, I'd like to be able to print the invoice without having all the links and headers showing on the hard copy.

Can this be done or is there a way to select a specific area of screen for printing?

John "Psycho" Siejkowski
meerkat
Senior Member
****

meerkat Avatar

Posts: 250

carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

Post by carlgundel on Jan 3, 2009 9:00:24 GMT -5

That's probably the best way to do it. You can pass the information you need into the RBprogram using parameters.

-Carl
meerkat Avatar
Something like this may work.


html "<script language='javascript'>
<!--
window.open('http://www.yourDomain.com:8008/seaside/go/runbasicpersonal?app=RBprogram','newTab','');
//--></script>"


Psycho
Full Member
***

Psycho Avatar

Posts: 196

Post by Psycho on Jan 3, 2009 11:02:41 GMT -5

carlgundel Avatar
That's probably the best way to do it. You can pass the information you need into the RBprogram using parameters.

-Carl
meerkat Avatar
Something like this may work.


html "<script language='javascript'>
<!--
window.open('http://www.yourDomain.com:8008/seaside/go/runbasicpersonal?app=RBprogram','newTab','');
//--></script>"




Thanks meerkat.
That get's me started but leaves me a new question.

Carl,

How would I go about passing the parameters when starting a program this way?

The child is currently a standalone .bas program, not a project, but I can dump it into a project so it can be called with this method. After reading your other posts about passing info from parent to child (and back), I undestand how to do it when using the native RB run, #render method but not sure how to accomplish it when running the child via html. ???

Any help would be appreciated.

John "Psycho" Siejkowski
meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Jan 3, 2009 15:13:52 GMT -5

Maybe you can change your project to ask for UrlKeys$

When you open the window, you pass UrlKeys$ of the program within the project you want to run. In this case "runProg$;"
Basically it runs itself. However this time when it runs, your project checks for UrlKeys$ and if there is one it does a run to that rogram within it's project.

html "<script > window.open('http://www.yourDomain.com:8008/seaside/go/runbasicpersonal?app=RBprogram&";runProg$";,'newTab','');</script>"

HTH

meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Jan 3, 2009 16:12:08 GMT -5

Just happen to think that you could have one project that does nothing but run stuff.

You could then use the script to open a window and tell run project what to run.

In a way it would be better. You could use it for all projects to run anything.
The bad is that it requires another project.

HTH.
Psycho
Full Member
***

Psycho Avatar

Posts: 196

Post by Psycho on Jan 3, 2009 19:40:23 GMT -5

Wow!
After struggling for several hours to try and realize your idea, I finally figured it out. :-[

My first success came after numerous endless loop mistakes and utilized two programs, one sending info back to the other. After getting that to work, it became clear and simple how to do it in just one program as you had suggested. :)

This program demonstrates my success at it's most simplistic level.
I think the if/then method to prevent the endless looping is solid enough but if you were successful with another method, I'd love to hear it.

if UrlKeys$<>"app=atest3" then
html "<script language='javascript'>
<!--
window.open('http://localhost:8008/seaside/go/runbasicpersonal?app=atest3','newTab','');
//--></script>"
end if

print "We are now in a new window!"
print "UrlKeys$= ";UrlKeys$

end


meerkat, thanks for the help on this.

John "Psycho" Siejkowski