That's the most direct approach; though I would probably use a while().

Michael


On Thu, Feb 14, 2013 at 4:38 PM, Nicholas Crookston <ncrookston...@gmail.com
> wrote:

> So, its just a simple as this:
>
> quite <- FALSE
> repeat if (quite) break else Sys.sleep(.5)
>
> And then have quite set to TRUE in the GUI code....
>
>
>
>
> On Thu, Feb 14, 2013 at 4:22 PM, Michael Lawrence <
> lawrence.mich...@gene.com> wrote:
>
>> I think you just want a loop contingent on some global condition that
>> your program sets to FALSE when it needs to quit. If you were using RGtk2,
>> it would just be gtkMain() and then gtkMainQuit(). Easy enough to do
>> directly in R, though.
>>
>> Michael
>>
>>
>>
>> On Thu, Feb 14, 2013 at 4:14 PM, Nicholas Crookston <
>> ncrookston...@gmail.com> wrote:
>>
>>> LIst:
>>>
>>> The other day I ask for some advice and I got some very helpful comments
>>> from Michael Lawrence (thanks), and off-list from John Verzani. Thanks to
>>> both.
>>>
>>> It looks like I will be able to build my application using tcktl, with
>>> 95 %
>>> of the code in gWidgets. I will have to use some tool-kit level code for
>>> some special purposes, at least for now. For the record, here is a trick
>>> that helped me see how gWidgets was interacting with tcltk: I added
>>> "trace
>>> (tcl)" and "trace (tkconfigure)" in my test scripts. I also looked at the
>>> sources for gWidgets. Both helped a lot.
>>>
>>> Here is another question for the list:
>>>
>>> I want to set up my "system" so that it starts from a desktop icon and
>>> closes when the user hits the "close" button on a window. That means
>>> that R
>>> would be started from the icon and the script that is my application runs
>>> from there. What I need is an R command that tells R to wait until the
>>> gWidgets "window" closes and then it can exit (actually, I'd set it up so
>>> that "q()" is run from a call back function). If I run R --no-save (or
>>> --save) < myScript.R, R exits as soon as EOF is reached on the script
>>> file.
>>>
>>> I've seen questions like this on the web but it seems like this should be
>>> easier than suggested in the replies to those questions (and some of the
>>> suggestions did not work). Am I missing a trick or do I need to get very
>>> tricky?
>>>
>>> BTW: As an experiment I tried the following: I made a new .Rprofile file
>>> that contains one command: source ("myGUI.R")   ... and this approach
>>> gets
>>> me what I want: the gui starts, the event loop works fine (this on
>>> Windows,
>>> starting from a cmd.exe window using R.exe  (not Rgui.exe).  So, what I'm
>>> after is something along the lines of running a script (like .Rprofile),
>>> but not ending when EOF is hit. This was an experiment, I do not intend
>>> to
>>> "field" the idea of hijacking the .Rprofile. Howerver the test shows more
>>> or less what I need.
>>>
>>> Comments?
>>>
>>> Cheers, Nick.
>>>
>>> PS: (I see I need to catch up my Windows box!)
>>> > sessionInfo()
>>> R version 2.15.1 (2012-06-22)
>>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>>
>>> locale:
>>> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
>>> States.1252
>>> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
>>>
>>> [5] LC_TIME=English_United States.1252
>>>
>>> attached base packages:
>>> [1] tcltk     stats     graphics  grDevices utils     datasets  methods
>>> base
>>>
>>> other attached packages:
>>> [1] gWidgetstcltk_0.0-54 digest_0.5.2         gWidgets_0.0-52
>>> >
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-SIG-GUI mailing list
>>> R-SIG-GUI@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>>>
>>
>>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-GUI mailing list
R-SIG-GUI@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-gui

Reply via email to