[R] Platform independent dialogs & menus?

Philippe Grosjean phgrosjean at sciviews.org
Tue Mar 21 08:17:13 CET 2006


Keith Chamberlain wrote:
> Dear Philippe, (& list)
> 
> I am not sure what is meant by 'floating window' but thank you for
> clarifying the 'win' prefix. I had been considering different possible
> senses of that prefix: win as in 'ts' window & windowing functions (clearly
> not), a generic 'win'dow function (abbreviated) for some GUI, or ms windows
> GUI windowing function in particular. I'm noticing that the description in
> {utils:winMenuAdd} indicates 'for windows', and it's quite clear (now,
> anyway) that it is to be taken as ms windows. But cool, I WAS barking down
> the wrong tree & can now refocus efforts. Curious how the correct meaning
> did not pop out at me. 
> 
> I was not aware of the {Session} package. What I've merely glanced at
> suggests the package is exactly (or really, really darn close) to what I had
> in mind. I appreciate the suggestion.

You're welcome. You will often notice that it worth doing a search on 
CRAN -well, as simple as looking at a couple of well-choosen keywords 
with RSiteSearch()-, before programming something "new". Often, the 
functionnality already exists somewhere, or at least, a good starting 
point for your own development. Note that I am also working on possible 
improvements of 'session'. If you like, I can send you my code.

> I downloaded SciViews & Tinn-R 2 days ago, and LOVE Tinn-R so far; syntax
> highlighting, oh yes! My rudimentary understanding, however, was that
> SciViews was only compiled for MS Windows so far. Can I run SciViews
> natively on a Mac now, or is the cross-platform part specific to some of the
> routines? 

Well, it is moving verrrry slowly to a platform-independent (and 
graphical widgets-independent) solution with the SciViews bundle on 
CRAN. This move is slow because, as a Windows user, I am satisfied by 
the current SciViews-R + R Commander + Tinn-R implementation for 
Windows, and I also have many priority tasks over this one.

Also for Tinn-R, Jose-Claudio Faria and myself consider to reimplement 
it in a platform-independent editor (using jEdit or Eclipse as a 
starting basis), but we still haven't time to start doing it. There are 
still many improvements to be done on the actual Tinn-R. For instance, 
Jose-Claudio is currently working on nice Sweave extensions for Tinn-R.
Best,

Philippe Grosjean

> Respecftully,
> KeithC.
> 
> -----Original Message-----
> From: Philippe Grosjean [mailto:phgrosjean at sciviews.org] 
> Sent: Monday, March 20, 2006 6:18 AM
> To: Keith Chamberlain
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Platform independent dialogs & menus?
> 
> Keith Chamberlain wrote:
> 
>>Dear list mates,
>>
>>Are {utils} dialog box functions, and winMenuAdd... functions used to
>>change (e.g. Console) menus, platform dependent? 
> 
> 
> Yes, Windows-only as the 'win' prefix suggests it.
> 
> 
>>I'm writing a script loaded with .First that provides first time users in 
>>a lab course with the ability to select, load, and change between what I
>>called a 'session' (more specific save that focuses on the session object 
>>I defined rather than the whole workspace, & intended to run many 
>>different sessions through the course of what would be one workspace).
> 
> 
> See also the 'session' package on CRAN for that.
> 
> 
>>I'm using winMenuAdd() calls to generate their 'Session' menu at startup,
>>the menus call functions sourced in for the menu actions. In the menu
>>actions, I call routines that use select.list() and file.choose() calls to
>>interact with users. 
>>
>>I do not work with Macs often, and from what I've gathered today in posts
>>about cross-platform difficulties, my sense of being intimidated "seems"
>>well placed to me (then again, breaks & some sleep would probably help). I
>>have not had the chance to test routines on a Mac yet, so I have no idea
>>what to expect. Is this tract I took with winMenuAdd() & related [{utils}
>>windows build] an appropriate route to take wrt the Mac build of R, or
> 
> would
> 
>>I be better off using another package? 
> 
> 
> For a platform-independent way of defining menus (you will have a 
> floating window with your menu), look at ?MenuAdd in package svWidgets 
> (SciViews bundle). With these functions, you even have more control on 
> the menus (define shortcuts, trigger the menus through R code, for 
> instance), and you can define your menu in one R instruction and a 
> simple text file to describe the menu structure, like this:
> 
> # Create a Tk window then add a menu to it
> $MyTkWindow
> |$MenuTest
> ||Objects  ~~ ls()
> ||-
> ||Path	   ~~ search()
> 
> # Add menus to the RGui console (Windows only)
> $ConsoleMain
> |$Testit
> ||One	  ~~ cat("One triggered!\n")
> ||-
> ||Two	  ~~ cat("Two triggered!\n")  ~~ state = "disable"
> ||$SubMenu
> |||Three  ~~ cat("Three triggered!\n")
> |||Four	  ~~ cat("Four triggered!\n")
> ||Five	  ~~ cat("Five triggered!\n")
> 
> # Add menu to the RGui console popup (Windows only)
> $ConsolePopup
> |$TestitPopup
> ||Six	  ~~ cat("Six triggered!\n")
> 
> If the preceeding menu definition is in a file named "Menus.txt" in the 
> /gui subdirectory of your "MyPackage" package, you can do:
> 
> library(svWidgets)
>  > tkWinAdd("MyTkWindow", title = "Menu window", pos ="-40+20")
>  > MenuReadPackage("MyPackage")
> 
> ... and you got all your menus configured at once (for MyTkWindows + 
> RGui console + RGui console popup menu
> 
> Best,
> 
> Philippe Grosjean
> 
> 
>>Please advise,
>>KeithC.
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide!
> 
> http://www.R-project.org/posting-guide.html
> 
>>
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list