On 21-Apr-02, Ronald Gruss wrote:
> Hi Carl,
> Friday, April 19, 2002, 11:25:02 AM, vous avez �crit:
>> On 19-Apr-02, Ronald Gruss wrote:
>>> Hi Rebolers,
>>> How could I 'do the calendar.r script from within another script
>>> and return to this parent script after closing 'calendar ?
>> I'm not sure what the calendar.r script is, but you can just do
>> another script from within a REBOL script and when the second
>> ends the first script will continue on. Try running this
>> script from the Console...
>> rebol []
>> print "Parent script running..."
>> do %calendar.r
>> print "Parent script running again..."
>> HTH.
> Just tried your tip : works ok
> The I tested this script :
> REBOL []
> view layout [button "calendar" [
> print "Parent script running..."
> do %calendar.r
> print "Parent script running again..."
> ]
> ]
> When I clic on 'calendar button, I get two windows, one running
> 'calendar as expected and th second one (console), but with the text
> below :
> Parent script running...
> Parent script running again...
> and when I close one window, my script ends.
> How could I get the behaviour I'm looking for ?
Hi again Ronald,
What's happening there is the calendar.r script uses your window
(instead of opening its own) and the printing forces the Console to
open, (so it's got somewhere to print to), and closing either closes
down REBOL.
To have calendar.r (which I've looked at now) open its own window you
could edit its script's last line to open a new one. ie...
change...
view/options cal-face [resize]
to...
view/new/options cal-face [resize]
(Note this'll mean calendar.r won't run properly now if run on its
own, so use a copy.)
That'll leave your window as you created it and it'll remain active.
Which means you'll be able to run calendar.r again, though only the
most recently opened version will behave properly.
The reason the Console opens is because of the printing in the button
block. Remove that and it won't.
However, "do"ing other scripts you're not fully familiar with from
your own scripts is not good REBOL practice as there might be
conflicts. (They can share words, for instance.) A safer way is to
use launch. ie, with the unmodified calendar.r, try this...
rebol []
view layout [
button "Calendar" [launch %calendar.r]
]
With that your own window will stay open and running a second
calendar.r shouldn't cause any problems to the first version, either.
It doesn't stop your script from running though, but nothing else will
happen with it till you press the button on it (or other buttons on
it), right?
Hope that's getting closer to a solution for you.
--
Carl Read
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.