Michelle Bourassa Stahl
2007-Dec-12 17:26 UTC
[R] eliminating cancel button in winDialogString call
I would like to use the function winDialogString to get input from a user to a program but would like to eliminate the cancel button option and just have the OK button appear. The problem is that if a user enters data then accidently hits Cancel instead of OK, the program may either run incorrectly or quit due to the error of having NULL for a variable. I can think of some unsophisticated ways around this like testing for a NULL value from a call to winDialogString and asking the user to reenter, however the better solution would be to just eliminate the Cancel button option. If I could find the code for the function winDialogString I might be able to create my own winDialgStringNoCancel function, however when I enter winDialogString at the > in the R console, I just get the .Internal call which is of no help to me. Can anyone help? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Michelle Bourassa Stahl Biometrician Western EcoSystems Technology, Inc. 2003 Central Avenue, Cheyenne, WY 82001 307-634-1756 mbstahl@west-inc.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [[alternative HTML version deleted]]
Prof Brian Ripley
2007-Dec-12 17:45 UTC
[R] eliminating cancel button in winDialogString call
On Wed, 12 Dec 2007, Michelle Bourassa Stahl wrote:> I would like to use the function winDialogString to get input from a user to > a program but would like to eliminate the cancel button option and just have > the OK button appear. The problem is that if a user enters data then > accidently hits Cancel instead of OK, the program may either run incorrectly > or quit due to the error of having NULL for a variable. I can think of some > unsophisticated ways around this like testing for a NULL value from a call > to winDialogString and asking the user to reenter, however the better > solution would be to just eliminate the Cancel button option. If I could > find the code for the function winDialogString I might be able to create my > own winDialgStringNoCancel function, however when I enter winDialogString at > the > in the R console, I just get the .Internal call which is of no help to > me. Can anyone help?But it does help: it tells you to look in the C code in the sources. I'll help you along by telling you it is in src/gnuwin32/extra.c, and refers to a graphapp function that draws the dialog box.> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Michelle Bourassa Stahl > > Biometrician > > Western EcoSystems Technology, Inc. > > 2003 Central Avenue, Cheyenne, WY 82001 > > 307-634-1756 > > mbstahl at west-inc.com > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595