s-news
[Top] [All Lists]

Re: [S] Returning Values from a Dialog

To: David Rose <Quinion_Rose@compuserve.com>
Subject: Re: [S] Returning Values from a Dialog
From: Frank E Harrell Jr <fharrell@virginia.edu>
Date: Thu, 30 Dec 1999 10:15:56 -0500
Cc: S Plus News <s-news@wubios.wustl.edu>
Organization: University of Virginia
References: <199912291457_MC2-92C5-BF81@compuserve.com>
Sender: owner-s-news@wubios.wustl.edu
David - this may not be directly related to what you want, but the Dialog
function
in the Design library will take an existing data frame and construct a dialog
for entering
data into that frame and for outputting computed values based on that data.
See
if it helps.  The documentation is at
http://hesweb1.med.virginia.edu/biostat/s/help/Dialog.html
See the examples in the documentation.  I wrote Dialog because I didn't want
to spend too much time making a multitude of guiCreate invocations for each
application - it wasn't much harder to write a more generic function. -Frank
Harrell

David Rose wrote:

> To any S-Plus programmers:
>
> [S-Plus 2000 running on Windows 95]
>
> I want to create a dialog which prompts me for a data frame and also a
> column within that data frame.  The names of both will then be supplied to
> an analysis (I've called it a "ribbon analysis" - this is irrelevant, but
> is the explanation for my naming convention) on the column of the data
> frame in question.
>
> I've borrowed the "Widgets" example from the manual and adapted it
> slightly, so that the following script delivers the name of the column
> correctly - but I can't get at the name of the selected data frame.  Can
> anybody tell me how I can access BOTH names?
>
> Many thanks to anybody who can help me with this.
>
> guiCreate("Property",
>    Name = "RibDataFrame",
>    DialogPrompt = "Data Frame",
>    CopyFrom = "TXPROP_DataFrames")
>
> guiCreate("Property",
>    Name = "RibDataColumn",
>    DialogPrompt = "Data Column",
>    CopyFrom = "TXPROP_DataFrameColumnsND",
>    UseQuotes = T)
>
> guiCreate("Property",
>    Name = "RibDataGroup",
>    Type = "Group",
>    DialogPrompt = "Data",
>    PropertyList = c("RibDataFrame", "RibDataColumn"))
>
> guiCreate("Property",
>    Name = "RibReturn",
>    DialogControl = "String",
>    DialogPrompt = "Save As",
>    DefaultValue = "Last.Ribbon")
>
> guiCreate("Property",
>    Name = "RibPage1",
>    Type = "Page",
>    dialogPrompt = "Data Page",
>    PropertyList = c("RibDataGroup", "RibReturn"))
>
> Ribbon <- function(RibDataFrame, RibDataColumn)
>    {
>    display.messagebox(cat("You are loading ", RibDataFrame, sep = ""))
>    invisible()
>    }
>
> guiCreate("FunctionInfo",
>    Name = "Ribbon",
>    DialogHeader = "Ribbon Chart",
>    PropertyList = c("RibPage1"),
>    ArgumentList = c("#0 = RibDataFrame", "#1 = RibDataColumn"))
>
> guiDisplayDialog("Function", Name = "Ribbon")
>
> (Incidentally, reversing the order of the argument list in FunctionInfo
> above does have the effect of returning the data frame as opposed to the
> selected column - but it delivers the contents of the data frame as opposed
> to its name.  I think I probably have to use the cbGetCurrValue() function
> for each of the objects I want to access, and link in a callback function -
> but at this point I'm out of my depth, as I don't yet understand callback
> functions.)
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message:  unsubscribe s-news

--
Frank E Harrell Jr
Professor of Biostatistics and Statistics
Division of Biostatistics and Epidemiology
Department of Health Evaluation Sciences
University of Virginia School of Medicine
http://hesweb1.med.virginia.edu/biostat


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>