[R-gui] Help with Using gtext in gWidgetsWWW for Outputting Results to Webpage

Fricker, Ronald (Ron) (CIV) rdfricke at nps.edu
Tue May 10 22:35:07 CEST 2011


Hi Virkki:  We're still in the process of setting the site up.  Given that we plan to only allow a restricted set of operations on the server, I'm hopeful we can get it all to work consistently.  But the proof will be once we go operational.  Happy to let you know how this all works out once we do.

Best,
Ron

-----Original Message-----
From: Virkki Arho [mailto:Arho.Virkki at vtt.fi] 
Sent: Tuesday, May 10, 2011 12:57 PM
To: Fricker, Ronald (Ron) (CIV); r-sig-gui at r-project.org
Subject: RE: [R-gui] Help with Using gtext in gWidgetsWWW for Outputting Results to Webpage


Dear Ron,

I am sorry about not being able to help you with these direct questions, but the sentence "Right now I'm testing the code on my local PC using localServerOpen()" caught my attention. Namely, I am very happy with the GTK2 version gwidgets, but had to abandon gWidgetsWWW because it was unreliable with long distance remote connections (with early 2010 versions). I wish I could understand the underlying javascript machinery better to help the authors to fix this...

Nevertheless, have you tested that you site will work in the actual use? At least I would be very happy to hear your experiences - as I feel that the technology itself would be very easy way to go for creating web pages (as compared to jumping into the tedius Java/JSP -world to do this. I am still hesitating in taking such a step).

Best Wishes,
Arho


--
Arho Virkki
PhD in Applied Mathematics
Research Scientist & Project Manager
VTT Technical Research Centre of Finland

-----Original Message-----
From: r-sig-gui-bounces at r-project.org [mailto:r-sig-gui-bounces at r-project.org] On Behalf Of Fricker, Ronald (Ron) (CIV)
Sent: 7. toukokuuta 2011 4:15
To: r-sig-gui at r-project.org
Subject: [R-gui] Help with Using gtext in gWidgetsWWW for Outputting Results to Webpage

All:  Using gWidgetsWWW, I'm in the process of designing a website that will provide users with a GUI to interact with various datasets.  As part of that, I want to provide users the ability select particular variables (via combo boxes) that will then result in summary (text) output being returned to the webpage.  Think of it as their choices ultimately result in a one- or two-way table being returned from the R table() function.

The way I have implemented it is with a series of comboboxes that users use to make selections and that ultimately return table() output to a gtext widget.  In so doing, I was essentially following the example at the end of "Examples for gWidgets" (Section 17.2, An alternative to ggenericwidget).  Right now I'm testing the code on my local PC using localServerOpen().

The problem is not with the function, but with the output.  Specifically, in the output the formatting (particularly newline returns) are stripped out and my table turns into a long string of numbers.  Similarly, any text that I add to the gtext widget is just appended.  So, I just get a long string of text and numbers that is essentially unintelligible.

What I want is output similar to what I would see in the R Console were I to generate a table there.  In an attempt to correct this, I have tried all manner of font options such as font.attr=c("monospace"), etc., and it seems that no matter what I try I can neither affect the displayed font (it's some sort of proportional Arial-like font) nor the exclusion of line returns.  (When I include \n in the text, it's simply stripped out/ignored.  However, \t works.)

Now, when I run the same code under gWidgets, I get a Courier-style font and the line returns show up.  That is, the output in the gtext widget looks much like I would see in the R Console.  So, my guess is that the browser is overriding the gWidgetsWWW output.  I'm running this in the latest version of Firefox.  (When I ran the same code using IE 9.0, the gtext widget does not even show up, but that's a different issue...)

With all that as background, two questions:

(1) Is the use of the gtext widget a good approach for what I want to do, or is there a better approach?

(2) If the gtext widget is the way to go, any suggestions for solving the above problem?

Many thanks,
Ron
Associate Professor
Operations Research Dept.
Naval Postgraduate School
Monterey, CA, USA


	[[alternative HTML version deleted]]

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



More information about the R-SIG-GUI mailing list