[R-gui] Re: RGui windows question

Duncan Murdoch murdoch at stats.uwo.ca
Sat Aug 14 05:02:22 CEST 2004


Okay, this is in place now in r-devel.  It'll probably be Monday
before I upload a new build though.

To add something to the right click menu for a graphics window, you
need to know the device number (dev.cur() returns it).  Say it's 2,
then 

winMenuAddItem("$Graph2Popup", "Caption", "action")

works.

Similar things work for the main menu of the graphics window, and for
the popup in the console.  I didn't do any others, because some don't
allow commands to be executed (e.g. the data editor is modal), and the
text editor gives no obvious way to specify which window you mean.

Duncan Murdoch

On Fri, 13 Aug 2004 10:38:31 -0400, Duncan Murdoch
<murdoch at stats.uwo.ca> wrote:

>On Fri, 13 Aug 2004 10:14:54 -0400, Duncan Murdoch
><murdoch at stats.uwo.ca> wrote :
>
>>On Thu, 12 Aug 2004 15:58:41 +0200, Erich Neuwirth
>><erich.neuwirth at univie.ac.at> wrote :
>>
>>>Duncan,
>>>next week, there will be  new release of the DCOM server and RExcel.
>>>Graphics is still an open issue.
>>>One of the possibilities would be to have R controlled by Excel render 
>>>the graphics and when the graphics is in its finalized, just using the 
>>>clipboard and import the wmf file into Excel.
>>>This coule be made more convenient when the right click menu in R
>>>graphics devices would allow to add user defined menu items with 
>>>commands, comparable to the winMenu functions.
>>>Would that be hard to add?
>>
>>This would be fairly easy to do as follows.  I'd add fake user menu
>>names corresponding to the existing menus and you'd refer to those,
>>e.g.
>>
>>winMenuAddItem('$GraphPopup', 'Caption', 'action')
>>
>>The names I can think of off the top of my head would be
>>
>>$ConsoleMain (the default location for new menu additions, but it
>>could also be specified, just for completeness)
>>$ConsolePopup
>>$GraphMain
>>$GraphPopup
>>$DataentryMain
>>$DataentryPopup
>>
>>I'll have to check the code to see if we've got others that I've
>>forgotten.
>>
>>We don't have separate popups for each instance of a graph window, so
>>you wouldn't be able to add local menu items to just one instance. 
>
>Oops, that's wrong.  We *do* have separate popups for each instance of
>a graph window.  This means that the items would have to be added
>*after* the window is open, and would not be there if you opened a new
>window later.  That makes managing them a little trickier.
>
>>
>>>Of course, it would be even more comfortable if the click also could 
>>>report the position like grid.locator in package grid does.
>>
>>That would be harder.  Currently no information about the menu gets
>>passed to the command.  I might be able to record some information and
>>make it visible (so for example you'd call a function
>>"winPopupLocation" to find out where the last popup occurred).   
>>
>>Duncan
>
>_______________________________________________
>R-SIG-GUI mailing list
>R-SIG-GUI at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-gui



More information about the R-SIG-GUI mailing list