Skip to content

[R-gui] Simple way to ask user for text string with R-commander plugin ?

3 messages · Ulrike Grömping, Greg Snow

#
Dear all,

I am just making my first steps in Rcmdr plugin programming and tcltk, 
please bear with me, this may be a very basic question.

My problem: From within a larger interface within R-commander (tk 
notebook with several pages, where the user can make many inputs), I 
want to allow interim storage of inputs (as a list within the R 
workspace). I want to allow the user to specify a name for this list. As 
this is something people shouldn't have to bother with unless they 
decide on storing, I would like the name to be asked in some popup 
dialogue.

I haven't found any standard widgets that are intended for this purpose, 
are there really none ?

I have therefore written a little dialogue with only one text entry box 
and OK and Cancel button. I have so far managed to store the text 
entered there (using assign and a fixed storage name), but I haven't 
managed to make the dialog return the text or at least an indicator 
whether the user pressed Cancel or OK. Rather, the return value from the 
dialogue is always FALSE. 

Any help is appreciated.

Regards, Ulrike
#
Can you show some minimal code showing what you have tried?

One possibility is that you are not waiting for the pop-up box to close but returning the (empty) string value immediately, but there could be others.  Some code would help us to help you.
#
Greg Snow schrieb:
Greg,

thanks for the offer, I hope it holds up for my next more difficult 
question :-)
With this one, I've now resorted to initializing the string to NULL, so 
that I get a NULL returned if the user cancels. So this question can be 
considered solved. (I just thought that I must have overlooked a 
standard input box widget, it seems like such a frequently-needed thing.)

Now, I'm stuck with this next topic, and I'll send that one to the list 
in a few minutes. I think that that one is more difficult, but hope that 
this list's expertise may have the right pointer for me.

Regards, Ulrike