Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: Linking
Pages: [1] Print
Author Topic: Linking  (Read 568 times)
JohnW
Newbie
*
Offline Offline

Posts: 9


View Profile
Linking
« on: January 13, 2004, 10:17:21 AM »

I have written a small database in view, and I was wondering if there is a way to link to a second program
without closing teh initial program?

for example how could I make a link in rebodex.r open calendar.r without closing rebodex.r?

:blink:  
Logged
CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
Linking
« Reply #1 on: January 14, 2004, 03:15:18 AM »

You can run another REBOL script using LAUNCH, though you'll then have two REBOL interpreters running.  An example...
Code:
>> write %test.r {rebol [] view layout [text "Test Script" ]}
>> view layout [button "Launch" [launch %test.r]]
To have the two programs communicate though isn't as simple, as they're completely seperate and don't have access to each-others' values and words.  If you need for them to talk to each-other, a mini-server would be one way to do it.  See the TCP section here...

http://www.rebol.com/docs/core23/rebolcore-13.html

for how to write a mini-server.

Hope that helps.
 
Logged

- Carl Read
yos
Guest


Email
Linking
« Reply #2 on: January 28, 2004, 04:27:40 AM »

I hate to have more than one REBOL interpreter running.
I see REBOL like an OS with the console for command line.
REBOL only miss a start or run command to lauch styles or layout.

The idea is to use :
view/new  to show a program (styles, layout etc... ici rebodex)
do-events  to continue the evaluation

view/new again on the calendar main face.

at this point you have the two wondows opened.

From what i say i have written a start function which view/new layout a styles
definition (face with [ ]) and when the user quit the program the screen position
is save in a .txt file.

If the style is %calc.s
start %calc.s   "run" the program
and create calc.txt on quitting if the windows offset have changed
 
Logged
CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
Linking
« Reply #3 on: January 29, 2004, 05:51:39 AM »

OK - here's the closest I've got to what I think you want.  It's three programs consisting of a menu program, one to add to a "database", (just a block with stuff in), and one to view the database....
Code:
rebol [
   file: %menu.r
]

if not value? 'menu-lo [
   menu-lo: layout [
       button "Edit DB" [do %edit-db.r]
       button "View DB" [do %view-db.r]
   ]
]

view/new/title menu-lo "Menu"

do-events
Code:
rebol [
   file: %edit-db.r
]

if not value? 'db [db: []]

if not value? 'edit-lo [
   edit-lo: layout [
       across
       title "Name:"
       name: field
       return
       title "Email:"
       email: field
       return
       button "Add" [
           Append/only db reduce [name/text email/text]
           if value? 'view-lo [
               view-txt/text: mold db
               show view-txt
           ]
       ]
   ]
]

view/new/title edit-lo "Edit DB"

do %menu.r
Code:
rebol [
   file: %view-db.r
]

if not value? 'db [db: []]

if not value? 'view-lo [
   view-lo: layout [
       view-txt: area 200x100 wrap mold db
   ]
]

view-txt/text: mold db

view/new/title view-lo "View DB"

do %menu.r
You can run them in any order, but if you run either of the db ones, the menu will also be run.

This shows two programs sharing data. (The DB block - it's not saved to disk, but of course that could be added.)

Unfortunately though, it doesn't allow you back to the console without closing all windows.  It's possible that by using some form of feel in the menu layout instead of using do-events you could have it so you could close the menu window and return to the console with the other two windows still open, but I didn't have time to explore this.

Hope this helps, anyway.
Logged

- Carl Read
JohnW
Newbie
*
Offline Offline

Posts: 9


View Profile
Linking
« Reply #4 on: January 29, 2004, 11:00:26 AM »

Thx for all teh information provided it's been of great help!
Logged
Pages: [1] Print 
Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: Linking
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 05, 2008, 11:51:12 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2233 Posts in 581 Topics by 1855 Members
Latest Member: SmartCho

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc