Can one REBOL program call another, and stay running?

Discussion in 'Rebol' started by swhite, Aug 17, 2011.

  1. swhite

    swhite Member

    I want to make a little program with a number of different functions, each called by a button. When I press one of the buttons, its function is performed, and when the function is done, the main screen with all the buttons remains. However, in the interest of modularity, I would like each function to be in its own REBOL program. Pressing the button would "do" the appropriate program. I can make that work, as shown in the following example, BUT, when the CALLED program quits, the CALLING program ends also. Is there some way to end the CALLED program so that the CALLING program remains in place?

    Thank you.

    Sample: (viewer.r is the CALLED program. It is Carl's image viewer from the script library.)

    DIANA-VIEWER-BUTTON: does [
    do %viewer.r
    ]

    DIANA-MAIN-WINDOW: layout [
    across
    image DIANA-LOGO
    vh1 "Document Index And Notepad Assistant"
    return
    button "Viewer" [DIANA-VIEWER-BUTTON]
    button "Quit" [DIANA-QUIT-BUTTON]
    ]

    view DIANA-MAIN-WINDOW
  2. Sunanda

    Sunanda New Member

Share This Page