[R-gui] Another R-GUI

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
26 Nov 2002 13:11:16 +0100


"Philippe Grosjean" <phgrosjean@sciviews.org> writes:

> Just to mention the very elegant way used by Splus: all features of the
> dialog box are described in a data frame. The data frame is passed to
> callback functions that can modify some of its features and return a
> modified data frame. In turn, the GUI actualizes the dialog box according to
> these modifications.
> 
> Just a mention also, of the tcltk package approach, where every single
> interaction with the dialog box is translated somehow into a R command.

Well, that's exaggerating a bit, but never mind. However, I think it's
important to notice the limitations of the Splus way:

- The interface needs to know about all the fields of all widgets.
  Names and data structures.

- For complicated widgets like text widgets, it becomes highly
  inefficient to pass all information back and forth between the R
  layer and the GUI layer.

Tcl/Tk sidesteps this rather nicely with its control language
approach. 

The first point could be consider mainly a registration issue although
it does enhance flexibility that you can easily load a Tcl extension and
immediately use any new widgets contained therein. (In fairness, there
are limits to how well this works, at least currently).

However, I think that the second point would be handled differently by
most modern GUI kits: Either you have a functional interface, or you
have a direct-manipulation object-oriented structure.

Consider inserting a word at the beginning of line 399 in a text
widget: It's not all that important whether you do it with

  tkinsert(txt, "399.0", "word") 

or with (say) 

  txt$insert(399,0,"word"),

but you really don't want to do

  function(df) {
    df$text[399] <- paste("word", df$text[399])
    df
  }

The important thing (as Duncan TL has been trying to ram down our
throats for quite a while for inter-language interfaces) is to let
data as far as possible stay on one side of the interface.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907